Regex to allow only digits, hypens, space, parentheses and should end with a digit (javascript) [duplicate]
This question already has answers here : Closed 7 years ago . Possible Duplicate: US Phone Number Verification I need to validate US phone number. It could be in the format: xxx-xxx-xxxx (xxx) xxx xxxx (xxx)-xxx-xxxx xxxxxxxxxx but it should not be xxx-xxx-xxxx- -xxx-xxx-xxxx It should accept digits, hyphens, space and parentheses. Currently I use ^\[0-9 \-\. ]+$ which does not validate dash at the beginning or end. staafl ^\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}$ Eugene Well my idea is (after some searching) not new at all! Look at this: A comprehensive regex for phone number validation This is an