I am trying to do a validation check on mobile number from both C# code and Javascript.
Following should be validated OK:
I tried using:
C# code:
@"(^((([0-9]{5})|((\+[0-9]{2})[0-9]+)|((00[0-9]{2})[0-9]+))|((([0-9]{8,})|((\+[0-9]{2})[0-9]+)|((00[0-9]{2})[0-9]+))))$)"
JavaScript:
/^((([0-9]{5})|(((00[0-9]{2})|(\+?[0-9]{2}))[0-9]+))|(([0-9]{8})|(((00[0-9]{2})|(\+?[0-9]{2}))[0-9]+)))$/
With these expressions I am able to validate for 1st and last requirement but not the 2nd one (+XXxxxx).
Please help me out on this issue.
use the OR option in the regular expression
Sample:
(\+XX)|(00)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.