webshim
webshim copied to clipboard
How to validate us phone no using patterns?
Hi Afarkas,
What is the pattern for validate US Phone nos formats like (123)456-7890, 123-456-7890, 1234567890, (123)-456-7890
This pattern " /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s.]{0,1}[0-9]{3}[-\s.]{0,1}[0-9]{4}$/" is working fine in jquery, but in webshim it is not working.
So can you help me about these? tx for advance.
Try the following instead: pattern="[(]{0,1}[0-9]{3}[)]{0,1}[-\s.]{0,1}[0-9]{3}[-\s.]{0,1}[0-9]{4}". HTML5 pattern already transform the string into a regular expression, which must match from start to end.
Working fine for the above formats, but i need to check these types of phone nos also +1 702 123 4567, how to validate?