c# - Want to add a validation using regular expression the format should be like this xxxxx-xxxxxxx-x -


i trying put validation using regular expression value text box xxxxx-xxxxxxx-x here trying

 [required]     [display(name = "cnic")]     [regularexpression(@"^\(([0-9]{5})[-]([0-9]{7})[-][0-9]{1}\)$", errormessage = "entered cnic format not valid.")]     public string cnic { get; set; } 

but shows cnic format not valid

[regularexpression(@"^[0-9+]{5}-[0-9+]{7}-[0-9]{1}$", errormessage = "entered cnic format not valid.")] 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -