My regex of choice is:
/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im
Valid formats:
(123) 456-7890
(123)456-7890
123-456-7890
123.456.7890
1234567890
+31636363634
075-63546725
More Related Contents:
- Regex – To allow numeric, only characters R, N, X, B, @ [closed]
- Find particular string from URL in JavaScript
- How to remove all line breaks from a string
- Regex pattern to match at least 1 number and 1 character in a string
- RegEx for Javascript to allow only alphanumeric
- Match only unicode letters
- How to parse a URL?
- Matching exact string with JavaScript
- Finding Plus Sign in Regular Expression
- How can I select an element by ID with jQuery using regex?
- Regex to Match Symbols: !$%^&*()_+|~-=`{}[]:”;’?,./
- Javascript regex returning true.. then false.. then true.. etc [duplicate]
- Regex to replace everything except numbers and a decimal point
- How can I replace newlines/line breaks with spaces in javascript?
- Remove specific HTML tag with its content from javascript string
- Can I use a regular expression in querySelectorAll?
- Regex remove repeated characters from a string by javascript
- What are non-word boundary in regex (\B), compared to word-boundary?
- Best way to parse HTML in Javascript
- Commenting Regular Expressions
- JavaScript Regex to match a URL in a field of text
- Regular Expression Pattern With A Variable
- javascript regex : only english letters allowed
- Javascript function need allow numbers, dot and comma
- Remove everything within script and style tags
- URL regex validation
- I would like to mimick conditionals in javascript regex
- In JavaScript, how can I replace text in an HTML page without affecting the tags?
- JavaScript: RegExp constructor vs RegEx literal
- Find and replace nth occurrence of [bracketed] expression in string