104 regular expressions found in this category!
Displaying page
of
pages;
Items to
| 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:
Igor Kravtsov
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[+][0-9]\d{2}-\d{3}-\d{4}$ |
| Description |
This is a basic telephone number vaildation which needs a compulsory prefix of a '+' sign with three digits and followed by a hipen, another three digits and finally followed by another hipen and four more digits.
Regards,
Senthil Gunabalan |
| Matches |
+974-584-5656 | +000-000-0000 | +323-343-3453 |
| Non-Matches |
974-584-5656 | +974 000 0000 |
| Author |
Rating:
Senthil Gunabalan
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(((^[BEGLMNS][1-9]\d?)|(^W[2-9])|(^(A[BL]|B[ABDHLNRST]|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]|F[KY]|G[LUY]|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]|M[EKL]|N[EGNPRW]|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKL-PRSTWY]|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)\d\d?)|(^W1[A-HJKSTUW0-9])|(((^WC[1-2])|(^EC[1-4])|(^SW1))[ABEHMNPRVWXY]))(\s*)?([0-9][ABD-HJLNP-UW-Z]{2}))$|(^GIR\s?0AA$) |
| Description |
For the terminally hard of thinking, a version of my UK postcode validator without WHITESPACE. Unlike most validators on regexlib, this knows valid postcode combinations, e.g. W1A is permitted, W1 is not, but W2 is. It should catch between 95-98% of invalid postcodes. |
| Matches |
W1A 1AA | EC1V1JN | N7 8BQ |
| Non-Matches |
W1A 1AM | BM1 1AB | EC1 1AA |
| Author |
Rating:
Howard Richards
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[\\(]{0,1}([0-9]){3}[\\)]{0,1}[ ]?([^0-1]){1}([0-9]){2}[ ]?[-]?[ ]?([0-9]){4}[ ]*((x){0,1}([0-9]){1,5}){0,1}$ |
| Description |
US Telephone Number where this is regular expression excludes the first number, after the area code,from being 0 or 1; it also allows an extension
to be added where it does not have to be prefixed by 'x'. |
| Matches |
(910)456-7890 | (910)456-8970 x12 | (910)456-8970 1211 |
| Non-Matches |
(910) 156-7890 | (910) 056-7890 | (910) 556-7890 x |
| Author |
Rating:
Bill Anderson
|
| Title |
Test
Details
Phone Numbers
|
| Expression |
^(1\s*[-\/\.]?)?(\((\d{3})\)|(\d{3}))\s*[-\/\.]?\s*(\d{3})\s*[-\/\.]?\s*(\d{4})\s*(([xX]|[eE][xX][tT])\.?\s*(\d+))*$ |
| Description |
This regular expressions matches phone numbers with area codes and optional US country code and optional phone extension. User have so many ways of entering phone numbers into input fields. This allows for some of the ones I've encountered. Feel free to contact me if you find ones that do not match. |
| Matches |
2405525009 | 1(240) 652-5009 | 240/752-5009 ext.55 |
| Non-Matches |
(2405525009 | 2 (240) 652-5009 |
| Author |
Rating:
Dean Dal Bozzo
|
| Title |
Test
Details
Validate US Postal Code
|
| Expression |
^(?!00000)(?<zip>(?<zip5>\d{5})(?:[ -](?=\d))?(?<zip4>\d{4})?)$ |
| Description |
Validate US zip codes. Matches all zip codes of exactly 5 digits except 00000. Optionally, matches zip5+zip4 where zip5 is exactly 5 digits, zip4 is exactly 4 digits, and zip5 and zip4 are, optionally, separated by a single space or hyphen. Captures zip5 and zip4 to named groups to facilitate program manipulation. |
| Matches |
12345 | 123456789 | 12345-6789 |
| Non-Matches |
12345- | 00000 | 00000-6789 |
| Author |
Rating:
Jerry Schmersahl
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(((^[BEGLMNS][1-9]\d?) | (^W[2-9] ) | ( ^( A[BL] | B[ABDHLNRST] | C[ABFHMORTVW] | D[ADEGHLNTY] | E[HNX] | F[KY] | G[LUY] | H[ADGPRSUX] | I[GMPV] | JE | K[ATWY] | L[ADELNSU] | M[EKL] | N[EGNPRW] | O[LX] | P[AEHLOR] | R[GHM] | S[AEGKL-PRSTWY] | T[ADFNQRSW] | UB | W[ADFNRSV] | YO | ZE ) \d\d?) | (^W1[A-HJKSTUW0-9]) | (( (^WC[1-2]) | (^EC[1-4]) | (^SW1) ) [ABEHMNPRVWXY] ) ) (\s*)? ([0-9][ABD-HJLNP-UW-Z]{2})) | (^GIR\s?0AA) |
| Description |
Here it is, the monster UK Postcode regular expression that should prevent the majority of miskeying. Unlike an most other regexes it only permits valid combinations of letters, e.g. BN works, BM does not. Spaces between the first and second parts are optional. I have tested this against a file of 7,500 valid postcodes, and also against a real-world list of about 12,000 which had some bad data. Manually checking a sample of the rejected ones showed it was working correctly (and how poor the data was!!).
I originally started by trying to adapt the GDSC document at http://www.govtalk.gov.uk/gdsc/html/frames/PostCode.htm and specifically their XSD pattern at http://www.govtalk.gov.uk/gdsc/schemaHtml/bs7666-v2-0-xsd-PostCodeType.htm but this turned out to be rather loose. Instead I wrote this. If you find any valid postcodes being rejected by this regex please let me know. |
| Matches |
W1A 1AA | EC2V 1JN | GIR 0AA |
| Non-Matches |
TB12 1AB | EC2V 1JM | W2A 1AA |
| Author |
Rating:
Howard Richards
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\(\d{3}\) ?\d{3}( |-)?\d{4}|^\d{3}( |-)?\d{3}( |-)?\d{4} |
| Description |
Expresion Regular para Teléfonos con clave lada en México
separada o no con guiones o espacios. Sirve para teléfonos estacionarios y/o celulares, con o sin paréntesis, 10 números a fuerzas, funciona en .net |
| Matches |
(658)154-1122 | 6581541122 | 658-154-1122 |
| Non-Matches |
(658 154 1122 | 759-1245 | 875 (489 1568) |
| Author |
Rating:
Alex Cons
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^p(ost)?[ |\.]*o(ffice)?[ |\.]*(box)?[ 0-9]*[^[a-z ]]* |
| Description |
This expression is useful for determining if an address is a PO Box type address. This can be useful in shipping systems as well as other systems that need to make determinations based on the type of address imputed. |
| Matches |
po box 4353 |
| Non-Matches |
pollo St. | P. O. Box d3f12s | BOX 23 |
| Author |
Rating:
Darryl Kuhn
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\s*((?:(?:\d+(?:\x20+\w+\.?)+(?:(?:\x20+STREET|ST|DRIVE|DR|AVENUE|AVE|ROAD|RD|LOOP|COURT|CT|CIRCLE|LANE|LN|BOULEVARD|BLVD)\.?)?)|(?:(?:P\.\x20?O\.|P\x20?O)\x20*Box\x20+\d+)|(?:General\x20+Delivery)|(?:C[\\\/]O\x20+(?:\w+\x20*)+))\,?\x20*(?:(?:(?:APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(?:LIP|PC|T(?:E|OP))|TRLR|UNIT|\x23)\.?\x20*(?:[a-zA-Z0-9\-]+))|(?:BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR))?)\,?\s+((?:(?:\d+(?:\x20+\w+\.?)+(?:(?:\x20+STREET|ST|DRIVE|DR|AVENUE|AVE|ROAD|RD|LOOP|COURT|CT|CIRCLE|LANE|LN|BOULEVARD|BLVD)\.?)?)|(?:(?:P\.\x20?O\.|P\x20?O)\x20*Box\x20+\d+)|(?:General\x20+Delivery)|(?:C[\\\/]O\x20+(?:\w+\x20*)+))\,?\x20*(?:(?:(?:APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(?:LIP|PC|T(?:E|OP))|TRLR|UNIT|\x23)\.?\x20*(?:[a-zA-Z0-9\-]+))|(?:BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR))?)?\,?\s+((?:[A-Za-z]+\x20*)+)\,\s+(A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])\s+(\d+(?:-\d+)?)\s*$ |
| Description |
Based on a regular expression from Michael Ash, this captures US street addresses and mailing addresses, single or multi-line (multi-line is more reliable), and breaks them into discrete parts for address line 1 and 2, city, state, and postal code. This expression is not perfect - with the interpreter I am using, some addresses refuse to match correctly. It should however work for most addresses, particularly when lines are delimited with carriage returns, tabs, or some other whitespace line delimiter that is not a space (\x20). Note: For improved compatibility, this expression does not use named groups.
**Output**
\1 = Address 1,
\2 = Address 2,
\3 = City,
\4 = State,
\5 = Postal Code |
| Matches |
P.O. Box 42 Huslia, AK 99746 | C/O John Paul, POBox 456, Motown, CA 96090 |
| Non-Matches |
4321 East 40th Apt #3 Anchorage AK 99504 | Stockton, CA 95215 |
| Author |
Rating:
Ross Hammer
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[A-Za-z]{1,2}[0-9A-Za-z]{1,2}[ ]?[0-9]{0,1}[A-Za-z]{2}$ |
| Description |
This regular expression can be used to validate UK postcodes. Especially useful if want to provide a client side validation on a web site. |
| Matches |
SW112LE | SW11 2LE | CR05LE |
| Non-Matches |
12CR0LE | 12CR 0LE | SWLE05 |
| Author |
Rating:
Santosh Potadar
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[1-9][0-9]{3}\s?[a-zA-Z]{2}$ |
| Description |
Validates Dutch Postal Codes (ZipCode). There was a previous one listed here, but it's not entirely correct. Namely that dutch postal codes can contain a zero but cannot start with one, so this one is the adjusted version. |
| Matches |
1234AB | 1234 AB | 1001 AB |
| Non-Matches |
0123AB | 1234A B | 0123 AB |
| Author |
Rating:
Jos Krause
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$ |
| Description |
The regex matches the UAE land phone numbers. Checks the area codes[04,02,06...etc] strictly. Force user to input phone numbers in strict manner(it take input 04 3452488, but not 04______spaces_______3452488) |
| Matches |
04 3452488 | 04 -3452488 | 04 - 3452499 |
| Non-Matches |
01 -3452488 | 04 34524888 | 08 3452488 |
| Author |
Rating:
Vathachira Joseph Bino
|
| Title |
Test
Details
Pattern Title
|
| Expression |
[0-9]{4}\s*[a-zA-Z]{2} |
| Description |
Dutch zip code expression
4 numbers - space yes/no - 2 letters
|
| Matches |
1054 WD | 1054WD | 1054 wd |
| Non-Matches |
10543 |
| Author |
Rating:
Roland Mensenkamp
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\d{5}-\d{4}|\d{5}|[A-Z]\d[A-Z] \d[A-Z]\d$ |
| Description |
This expression matches three different formats of postal codes: 5 digit US ZIP code, 5 digit US ZIP code + 4, and 6 digit alphanumeric Canadian Postal Code. The first one must be 5 numeric digits. The ZIP+4 must be 5 numeric digits, a hyphen, and then 4 numeric digits. The Canadian postal code must be of the form ANA NAN where A is any uppercase alphabetic character and N is a numeric digit from 0 to 9. |
| Matches |
44240 | 44240-5555 | G3H 6A3 |
| Non-Matches |
Ohio | abc | g3h6a3 |
| Author |
Rating:
Steven Smith
|
| 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:
Jeff Gabriel
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(?<national>\+?(?:86)?)(?<separator>\s?-?)(?<phone>(?<vender>13[0-4])(?<area>\d{4})(?<id>\d{4}))$ |
| Description |
Just test in C#.
Validates a China Unicom mobile phone number with (or without) the International code.
|
| Matches |
+8613012345678 | 86 13012345678 | 13245679087 |
| Non-Matches |
+86130123456781231434352 | 13560012513 | ++8613012345678 |
| Author |
Rating:
Evan Tao
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(^\([0]\d{2}\))(\d{6,7}$) |
| Description |
Validator for New Zealand Mobile phone numbers. Will look for the first number being a 0 and must be a number or either 6 or 7 digits long after to initial (021) suffix |
| Matches |
(021)1234567 | (021)123456 | (000)000000 |
| Non-Matches |
(123)1234567 | 025123456 | 0252345678 |
| Author |
Rating:
Graeme Allwood
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(1?(-?\d{3})-?)?(\d{3})(-?\d{4})$ |
| Description |
US Telephone Reg expression that allows 7, 10 or 11 digits with or without hyphens. |
| Matches |
15615552323 | 1-561-555-1212 | 5613333 |
| Non-Matches |
1-555-5555 | 15553333 | 0-561-555-1212 |
| Author |
Rating:
jay gann
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(\d{4,6}) |
| Description |
Simple Postcode - this is the first test of the new WebService :-) |
| Matches |
4078 | 539999 |
| Non-Matches |
dfasdf | afasdfsad |
| Author |
Rating:
Darren Neimke
|
Displaying page
of
pages;
Items to