US phone number validation

Q

How to perform a validation on US phone numbers using a regular expression? For example, "(021)423-2323" is an valid US phone number.

✍: Guest

A

To perform a validation on US phone numbers, try this regular expression:

^\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}$

Click the button to test this regular expression here online:

2013-01-27, 2284👍, 0💬