Reputation: 1495
I am using 1000hz for validation. for +1(999) 999-999 phone number I am using this regex in pattern
^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$
but its not working.
Upvotes: 0
Views: 275
Reputation: 163207
You need to match a digit after matching the optional +
^[+]*\d[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s./0-9]*$
Or a bit more precise version::
^[+]?\d(?:\(\d{3}\)|[0-9]{3}) \d{3}-\d{3}$
Upvotes: 2