Can somebody give me the regex for phone number.
The format is :
A phone number used for calls must contain only the characters + , – , * and 0-9.
Only the leading character may be a + Or *
Can somebody give me the regex for phone number.
The format is :
A phone number used for calls must contain only the characters + , – , * and 0-9.
Only the leading character may be a + Or *
The following regex will do:
^\+?[0-9\-]+\*?$
How it works:
^\+?[0-9\-]+\*?Note that this is just a simple example to match the pattern as you defined it. A more elaborate discussion on handling US phone numbers with Regex can be found here