Posted on: 9/9/2015 9:45:45 PM | Views : 740

I'm validating a RFC (RFC: Registro Federal de Contribuyentes, Federal Taxpayers Registration) using a regex pattern that I built.
My regex validates the RFC without spaces, "-", ".", "$", and other special characters (except for the "Ñ" and "&").
In my property of RFC, on my ViewModel, I use the Data Annotation of RegularExpression to make the validation on the server-side, and I created in JS, on the View, one method to validate the RFC introduced.
This is my code on my ViewModel:
[Required] [DisplayName("R. F. C.")] [RegularExpression(@"[a-zA-ZñÑ&]{4}[0-9]{6}[a-zA-ZñÑ0-9&]{2,3}", ErrorMessage = "El RFC no debe contener espacios, -, ni otros caracteres especiales.")] [StringLength(13)] public string RFC { get; set; } and my JS code:
function getInvoicingData() { var rfc = ...

Go to the complete details ...