I need my users to input very specific cell phone format cause my app will be sending sms to them
So, I need their cell phone formats to be like this
04AB-XXXXXXX
Where A can be either 1 or 2
and B can be either 2, 4 or 6
X can be from 0-9
There must be exactly 7 numbers (X) after 04AB
It must always start with 04
Examples:
04140000000 allowed
04240000000 allowed
04340000000 not allowed
14240000000 not allowed
04170000000 not allowed
So my property would need a regular expression validator but I wouldnt even know where to start… I just got this from a tutorial but it’s for a different format
[RegularExpression(@"^\$?\d+(\.(\d{2}))?$")]
this needs to be as strictly as possible because its gonna be used for text messaging.
thanks in advance..
you need this:
That is withouth the “-“
is with the “-” and
allows to use the “-” or leave it
the 0-9 can be replaced with \d like (I like [0-9] for beginners readability):
so it can become something like: