I need regular expression validation for first 5 digits are numbers then hyphen and then one digit is alphabet and other one is numeric.
ex : 23456-p5 or 12345-a3 something like that.
I have tried something like this to start with
/^\d{5}-\d{2}$/
and in model i have given like this as we don't have to give ^ or $ in data annotations
[RegularExpression(@"d{5}-\d{2}")]
But i couldnt get it to work even this.
Try this:
[RegularExpression(@"^\d{5}-[a-zA-Z]\d$")]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With