regex - MVC 5 RegularExpression Phone Number -
i trying write regular look matches theese cases.
phone number can be: 8 digits 0-9 or 12 digits 0-9 or 12 digits 0-9 , + sign so: 12345678, 0012345678, +0012345678 valid options
[regularexpression("^[0-9]{8})|[0-9]+{12}|[0-9]{11}$", errormessage = "invalid phone")]
would nice on + validation case, plus sign have in origin (following 10 digits) , on 12 digits validation there have 00 first (then next 10 digits)
you seek below regex,
@"^(?:\d{8}|00\d{10}|\+\d{2}\d{8})$"
regex asp.net-mvc asp.net-mvc-5
No comments:
Post a Comment