RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 56 regular expressions found.

Change page:   |    Displaying page 1 of 3 pages; Items 1 to 20
Title Test Details Pattern Title
Expression
^[2-9]\d{2}-\d{3}-\d{4}$
Description
This expression matches a hyphen separated US phone number, of the form ANN-NNN-NNNN, where A is between 2 and 9 and N is between 0 and 9.
Matches
800-555-5555 | 333-444-5555 | 212-666-1234
Non-Matches
000-000-0000 | 123-456-7890 | 2126661234
Author Rating: The rating for this expression. Steven Smith
Title Test Details Pattern Title
Expression
((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}
Description
US Phone Number -- doesn't check to see if first digit is legal (not a 0 or 1).
Matches
(123) 456-7890 | 123-456-7890
Non-Matches
1234567890
Author Rating: Not yet rated. Steven Smith
Title Test Details Pattern Title
Expression
^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$
Description
This RegEx requires a US phone number WITH area code. It is written to all users to enter whatever delimiters they want or no delimiters at all (i.e. 111-222-3333, or 111.222.3333, or (111) 222-3333, or 1112223333, etc...).
Matches
(111) 222-3333 | 1112223333 | 111-222-3333
Non-Matches
11122223333 | 11112223333 | 11122233333
Author Rating: The rating for this expression. Laurence O'Donnell
Title Test Details Pattern Title
Expression
^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$
Description
Matches US phone number format. 1 in the beginning is optional, area code is required, spaces or dashes can be used as optional divider between number groups. Also alphanumeric format is allowed after area code.
Matches
1-(123)-123-1234 | 123 123 1234 | 1-800-ALPHNUM
Non-Matches
1.123.123.1234 | (123)-1234-123 | 123-1234
Author Rating: The rating for this expression. Igor Kravtsov
Title Test Details Pattern Title
Expression
((\(\d{3}\)?)|(\d{3}))([\s-./]?)(\d{3})([\s-./]?)(\d{4})
Description
US Phone number that accept a dot, a space, a dash, a forward slash, between the numbers. Will Accept a 1 or 0 in front. Area Code not necessary
Matches
1.2123644567 | 0-234.567/8912 | 1-(212)-123 4567
Non-Matches
0-212364345 | 1212-364,4321 | 0212\345/6789
Author Rating: Not yet rated. Mart Maasikas
Title Test Details Pattern Title
Expression
^([0-1]([\s-./\\])?)?(\(?[2-9]\d{2}\)?|[2-9]\d{3})([\s-./\\])?(\d{3}([\s-./\\])?\d{4}|[a-zA-Z0-9]{7})$
Description
It checks for Valid US Phone numbers. Accepts ".",Space,\,/,- as delim.
Matches
1.222.333.1234 | 1-223-123-1232 | 12223334444
Non-Matches
1.1.123123.123 | 12-1322-112-31 | 11231321131
Author Rating: Not yet rated. Amit Deshpande
Title Test Details Pattern Title
Expression
^\(?[\d]{3}\)?[\s-]?[\d]{3}[\s-]?[\d]{4}$
Description
This regular expression matches 10 digit US Phone numbers in different formats. Some examples are 1)area code in paranthesis. 2)space between different parts of the phone number. 3)no space between different parts of the number. 4)dashes between parts.
Matches
(573)8841878 | 573-884-1234 | 573 234 1256
Non-Matches
(573)(673)2345 | 573-12-2345
Author Rating: Not yet rated. kode kode
Title Test Details Pattern Title
Expression
^([\(]{1}[0-9]{3}[\)]{1}[ |\-]{0,1}|^[0-9]{3}[\-| ])?[0-9]{3}(\-| ){1}[0-9]{4}$
Description
Validates US phone numbers. Phone number can be delimited with dashes or spaces. Area code can optionally include parentheses. To optionally validate area codes, try this expression. ^([\(]{1}[0-9]{3}[\)]{1}[ |\-]{0,1}|^[0-9]{3}[\-| ])?[0-9]{3}(\-| ){1}[0-9]{4}$
Matches
(111) 223-2332 | (222)233-2332 | 232-323-3233
Non-Matches
(ddd) 223-2332 | 222-232/2333 | 322-3223-222
Author Rating: The rating for this expression. gabe g
Title Test Details Pattern Title
Expression
^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$
Description
More permissive than others on the site, this one allows you to let a user enter US phone numbers in the way they most commonly use, without letting them enter non-valid combinations.
Matches
5551212 | 614555-1212 | (614)555-1212
Non-Matches
A12-5555 | (614-555-1212 | 555*1212
Author Rating: The rating for this expression. Jeff Gabriel
Title Test Details Pattern Title
Expression
^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$
Description
Basic US phone number matching pattern. I found this place and used a regex, so figured I'd share.
Matches
(888) 555-1212 | 888.555.1212 | (888) 555.1212 ext. 1212
Non-Matches
(800) got-fish | 011+ 78907 2344323
Author Rating: Not yet rated. Jon Stephens
Title Test Details Pattern Title
Expression
^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$
Description
US Phone Number: This regular expression for US phone numbers conforms to NANP A-digit and D-digit requirments (ANN-DNN-NNNN). Area Codes 001-199 are not permitted; Central Office Codes 001-199 are not permitted. Format validation accepts 10-digits without delimiters, optional parens on area code, and optional spaces or dashes between area code, central office code and station code. Acceptable formats include 2225551212, 222 555 1212, 222-555-1212, (222) 555 1212, (222) 555-1212, etc. You can add/remove formatting options to meet your needs.
Matches
5305551212 | (530) 555-1212 | 530-555-1212
Non-Matches
0010011212 | 1991991212 | 123) not-good
Author Rating: The rating for this expression. Don Johnston
Title Test Details Pattern Title
Expression
^(?:\([2-9]\d{2}\)\ ?|(?:[2-9]\d{2}\-))[2-9]\d{2}\-\d{4}$
Description
This US phone number edit with restricted format options: Accepts optional parens on area code with or without following space, and dashes between area code, central office code and station code. Formats include only (222) 555-1212 (with or without a space) and 222-555-1212. Conforms to NANP A-digit and D-digit requirements (ANN-DNN-NNNN). Area Codes 001-199 are not permitted; Central Office Codes 001-199 are not permitted.
Matches
(234) 555-1212 | (234)555-1212 | 234-555-1212
Non-Matches
(234)5551212 | 234 555 1212 | 234) 555-1212
Author Rating: Not yet rated. Don Johnston
Title Test Details Pattern Title
Expression
^(\d{3}-\d{3}-\d{4})*$
Description
This expression is a very simplex expression that allows null values or 3 digits, dash, 3 digits, dash, 4 digits. It validates a basic US phone number. Written by Jason N. Gaylord.
Matches
555-555-1212 | 123-456-7890
Non-Matches
555.555.1212 | (555) 555-1212 | 5555551212
Author Rating: Not yet rated. Jason N. Gaylord
Title Test Details Pattern Title
Expression
^(\(?[0-9]{3}[\)-\.]?\ ?)?[0-9]{3}[-\.]?[0-9]{4}$
Description
Simple US phone number matching, allowing area code or not. Allows spaces, dashes, dots, or none of the above. Area code, if entered, can be surrounded by parenthesis or not.
Matches
(555) 555-5555 | 555.555.5555 | 555-5555
Non-Matches
(555)-555-5555
Author Rating: The rating for this expression. Dan Breen
Title Test Details Any use phone number with support for extensions
Expression
\(?\s*(?<area>\d{3})\s*[\)\.\-]?\s*(?<first>\d{3})\s*[\-\.]?\s*(?<second>\d{4})\D*(?<ext>\d*)
Description
Matches any properly entered US phone number (area code, first three, last four) plus support for extensions (optional)
Matches
5551213333 555.111.1234 555.888.8888x4444
Non-Matches
555-555-123
Author Rating: Not yet rated. Paul
Title Test Details US phone numbers
Expression
^\(?\d{3}?\)?\-?\d{3}?\-?\d{4}?$
Description
Matches US phone numbers with area code inclosed in parents...
Matches
(425)345-3456
Non-Matches
425-234-4444
Author Rating: Not yet rated. Miroslav Spassov
Title Test Details US Phone Number
Expression
^1?[-\. ]?(\(\d{3}\)?[-\. ]?|\d{3}?[-\. ]?)?\d{3}?[-\. ]?\d{4}$
Description
US Phone number with optional leading 1, optional area code, and optional delimiters (hyphen, space or period)
Matches
18005551212 1.800.555.1212 1-800-555-1212 (800)555-1212 8005551212 800-555-1212 800.555.1212 5551212 555-1212 555.1212
Non-Matches
2-800-555-1212 55-51212 551212 15551212
Author Rating: The rating for this expression. Jason Kittredge
Title Test Details Phone Number
Expression
^([a-zA-Z,#/ \.\(\)\-\+\*]*[0-9]){7}[0-9a-zA-Z,#/ \.\(\)\-\+\*]*$
Description
Very flexible phone number entry. -- There are many valid ways to enter a phone number, and often there is other data that a restrictive Regex pattern will not abide. -- This pattern accepts any number of letters, commas, pound signs, slashes, spaces, periods, parenthesis, hyphens, plus signs, and asterisks... but amongst it scans for a minimum of 7 digits (modify {7} to adjust the minimum number of required digits (i.e. 10 for area code + phone number, 18 for long international numbers). -- This pattern does not attempt to restrict the entered phone number format in any way, but instead just verfies that enough digits for one was entered. -- Data in excess of the 7 required digits is allowed. -- I've posted another submission that forces compliance for US phone numbers.
Matches
1234567 | 12345678 | (555) 987-6543 ext 210 | 999-666-7777-x1967
Non-Matches
123456 | 555-123
Author Rating: The rating for this expression. Tim N Tousley
Title Test Details US Phone Number
Expression
^([a-zA-Z,#/ \.\(\)\-\+\*]*[2-9])([a-zA-Z,#/ \.\(\)\-\+\*]*[0-9]){2}([a-zA-Z,#/ \.\(\)\-\+\*]*[2-9])([a-zA-Z,#/ \.\(\)\-\+\*]*[0-9]){6}[0-9a-zA-Z,#/ \.\(\)\-\+\*]*$
Description
Very flexible US phone number entry. -- There are many valid ways to enter a phone number, and often there is other data that a restrictive Regex pattern will not abide. -- This pattern accepts any number of letters, commas, pound signs, slashes, spaces, periods, parenthesis, hyphens, plus signs, and asterisks... but amongst it scans for a minimum of 10 digits, the first and fourth of which cannot be 0 or 1 (per US phone number standards in 2006). -- Data in excess of the 10 required digits is allowed.
Matches
987-654-3210 | (555) 555-1212 | (555) 487-1391 x652 | phn (555) 987-6743 ext. 21012
Non-Matches
123 456-7890 | (555) 000-1111
Author Rating: The rating for this expression. Tim N Tousley
Title Test Details A Forgiving US Phone Number
Expression
^(1?)(-| ?)(\()?([0-9]{3})(\)|-| |\)-|\) )?([0-9]{3})(-| )?([0-9]{4}|[0-9]{4})$
Description
This is a fairly forgiving phone number match. It's original purpose was to extract phone numbers from the details field in our database and into their own phone number table. It worked brilliantly. Enjoy!
Matches
14165551212, 4165551212, (416)5551212, 416 555 1212, 416-555-1212, (416)-555-1212, (416) 555 1212, 1-900-888-1212
Non-Matches
456-444-45464, 416-SEX-POOP, 4!6-777-#232
Author Rating: The rating for this expression. Doug Jones
Change page:   |    Displaying page 1 of 3 pages; Items 1 to 20

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials