Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
(?s)(?:\e\[(?:(\d+);?)*([A-Za-z])(.*?))(?=\e\[|\z) |
| Description |
This expression will match all of the commands(escape codes) used in ANSI files. These are what were used to create the colors/blocks on BBS's for those of us that once dialed into them.
http://www.wikipedia.org/wiki/ANSI_escape_code has a reference for ANSI escape codes.
http://idledreams.net/lordscarlet/posts/153.aspx shows an example of the engine I have created surrounding the expression |
| Matches |
[32mHello | [1;35mTest | [2J |
| Non-Matches |
abc |
| Author |
Rating:
Not yet rated.
Doug Moore
|
| Title |
Test
Details
Pattern Title
|
| Expression |
[-+]((0[0-9]|1[0-3]):([03]0|45)|14:00) |
| Description |
This matches timezone offsets. Also matches non-hour offsets like India (+05:30) and Nepal (+5:45}. See for more timezone information: http://en.wikipedia.org/wiki/Time_zone |
| Matches |
+00:00 | -05:00 | +13:45 |
| Non-Matches |
+14:30 | +01:14 | -09:55 |
| Author |
Rating:
Not yet rated.
Robert van der Boon
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b |
| Description |
This is my attempt to find out valid german postal codes (PLZ or Postleitzahlen).
After the German Unification the numbers were changed to a five digit system. The postal codes starts with the two digit "Leitzahl". This is a number between 00 and 99 excluding the not yet used numbers: 00, 05, 43 and 62! After that follows directly a three digit number, 000-999.
Comments welcome. This works for me, however I think it could be written more compact, but could not figure out how ;-)
For more information on german postal codes see:
http://de.wikipedia.org/wiki/Liste_der_Postleitbereiche_Deutschland
http://de.wikipedia.org/wiki/Postleitzahl_%28Deutschland%29
http://en.wikipedia.org/wiki/List_of_postal_codes_in_Germany |
| Matches |
12556 | 01550 | 80796 |
| Non-Matches |
05234 | 8973 | 62980 |
| Author |
Rating:
Markus Matern
|
| Title |
Test
Details
Canadian postal code
|
| Expression |
\b(?([A-Z])[^DFIOQUWZ])\d(?([A-Z])[^DFIOQU])\d(?([A-Z])[^DFIOQUWZ])\d\b |
| Description |
Matches Canadian postal codes from http://en.wikipedia.org/wiki/Canadian_postal_code. Originally I was going to use http://regexlib.com/REDetails.aspx?regexp_id=1676 but C# did not like it. I rewrote it to this version which works correctly. |
| Matches |
K7P3K6 |
| Non-Matches |
W7P3K6 |
| Author |
Rating:
Not yet rated.
Matthew Hartman
|
| Title |
Test
Details
UK postcode (any Case allowed)
|
| Expression |
(^[Bb][Ff][Pp][Oo]\s*[0-9]{1,4})|(^[Gg][Ii][Rr]\s*0[Aa][Aa]$)|([Aa][Ss][Cc][Nn]|[Bb][Bb][Nn][Dd]|[Bb][Ii][Qq][Qq]|[Ff][Ii][Qq][Qq]|[Pp][Cc][Rr][Nn]|[Ss][Ii][Qq][Qq]|[Ss][Tt][Hh][Ll]|[Tt][Dd][Cc][Uu]\s*1[Zz][Zz])|(^([Aa][BLbl]|[Bb][ABDHLNRSTabdhlnrst]?|[Cc][ABFHMORTVWabfhmortvw]|[Dd][ADEGHLNTYadeghlnty]|[Ee][CHNXchnx]?|[Ff][KYky]|[Gg][LUYluy]?|[Hh][ADGPRSUXadgprsux]|[Ii][GMPVgmpv]|[JE]|[je]|[Kk][ATWYatwy]|[Ll][ADELNSUadelnsu]?|[Mm][EKLekl]?|[Nn][EGNPRWegnprw]?|[Oo][LXlx]|[Pp][AEHLORaehlor]|[Rr][GHMghm]|[Ss][AEGK-PRSTWYaegk-prstwy]?|[Tt][ADFNQRSWadfnqrsw]|[UB]|[ub]|[Ww][A-DFGHJKMNR-Wa-dfghjkmnr-w]?|[YO]|[yo]|[ZE]|[ze])[1-9][0-9]?[ABEHMNPRVWXYabehmnprvwxy]?\s*[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}$) |
| Description |
This is my combination of other UK postcode examples to date in this library. This is similar to Howard Richards’s solution in that it only permits valid combinations of letters, e.g. BN works, BM does not. The space(s) are optional, and the string to match does not have to be in an upper or lower case. On top of that this allows BFPO (http://www.bfpo.mod.uk/bfponumbers_ships.htm) and Overseas Territories Postcodes (http://en.wikipedia.org/wiki/UK_postcodes) Please let me know if you have any suggetion to improve this! |
| Matches |
BHPO 111 | GIR 0AA | SW1 1ZZ | BT1 3RT |
| Non-Matches |
SW1 1ZZ1 | BT01 3RT |
| Author |
Rating:
Not yet rated.
Dmitri Rechetilov
|
| Title |
Test
Details
UK postcode (matching caps only)
|
| Expression |
(^BFPO\s*[0-9]{1,4})|(^GIR\s*0AA$)|(ASCN|BBND|BIQQ|FIQQ|PCRN|SIQQ|STHL|TDCU\s*1ZZ)|(^(A[BL]|B[ABDHLNRST]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[CHNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM|S[AEGK-PRSTWY]?|Y[ADFNQRSW|UB|W[A-DFGHJKMNR-W]?|[YO]|[ZE])[1-9][0-9]?[ABEHMNPRVWXY]?\s*[0-9][ABD-HJLNP-UW-Z]{2}$) |
| Description |
This is my combination of other UK postcode examples to date in this library. This is similar to Howard Richards’s solution in that it only permits valid combinations of letters, e.g. BN works, BM does not. The space(s) are optional, the string to match should be in upper case. On top of that, this solution allows BFPO (http://www.bfpo.mod.uk/bfponumbers_ships.htm) and Overseas Territories Postcodes (http://en.wikipedia.org/wiki/UK_postcodes) Please let me know if you have any suggetion to improve this! |
| Matches |
BHPO 111 | GIR 0AA | SW1 1ZZ | BT1 3RT |
| Non-Matches |
SW1 1ZZ1 | BT01 3RT |
| Author |
Rating:
Not yet rated.
Dmitri Rechetilov
|
| Title |
Test
Details
Country codes ISO 3166-1 (alfa-2)
|
| Expression |
^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|X|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R|NA|OR|WT)|L(AO|B(N|R|Y)|CA|IE|KA|SO|TU|UX|VA)|M(A(C|F|R)|CO|D(A|G|V)|EX|HL|KD|L(I|T)|MR|N(E|G|P)|OZ|RT|SR|TQ|US|WI|Y(S|T))|N(AM|CL|ER|FK|GA|I(C|U)|LD|OR|PL|RU|ZL)|OMN|P(A(K|N)|CN|ER|HL|LW|NG|OL|R(I|K|T|Y)|SE|YF)|QAT|R(EU|OU|US|WA)|S(AU|DN|EN|G(P|S)|HN|JM|L(B|E|V)|MR|OM|PM|RB|TP|UR|V(K|N)|W(E|Z)|Y(C|R))|T(C(A|D)|GO|HA|JK|K(L|M)|LS|ON|TO|U(N|R|V)|WN|ZA)|U(EN|GA|KR|MI|RY|SA|ZB)|V(AT|CT|GB|IR|NM|UT)|W(LF|SM)|YEM|Z(AF|MB|WE))$ |
| Description |
Table:
http://en.wikipedia.org/wiki/ISO_3166-1. |
| Matches |
only country code (three upper letters) |
| Non-Matches |
others |
| Author |
Rating:
Not yet rated.
Juraj Hajdúch (SK)
|
| Title |
Test
Details
Country codes ISO 3166-1 (numeric)
|
| Expression |
^(0(0(4|8)|1(0|2|6)|2(0|4|8)|3(1|2|6)|4(0|4|8)|5(0|1|2|6)|6(0|4|8)|7(0|2|4|6)|8(4|6)|9(0|2|6))|1(0(0|4|8)|1(2|6)|2(0|4)|3(2|6)|4(0|4|8)|5(2|6)|6(2|6)|7(0|4|5|8)|8(0|4|8)|9(1|2|6))|2(0(3|4|8)|1(2|4|8)|2(2|6)|3(1|2|3|4|8|9)|4(2|4|8)|5(0|4|8)|6(0|2|6|8)|7(0|5|6)|88|9(2|6))|3(0(0|4|8)|1(2|6)|2(0|4|8)|3(2|4|6)|4(0|4|8)|5(2|6)|6(0|4|8)|7(2|6)|8(0|4|8|9)|92)|4(0(0|4|8)|1(0|4|7|8)|2(2|6|8)|3(0|4|8)|4(0|2|6)|5(0|4|8)|6(2|6)|7(0|4|8)|8(0|4)|9(2|6|8|9))|5(0(0|4|8)|1(2|6)|2(0|4|8)|3(0|3)|4(0|8)|5(4|8)|6(2|6)|7(0|4|8)|8(0|1|3|4|5|6)|9(1|8))|6(0(0|4|8)|1(2|6)|2(0|4|6)|3(0|4|8)|4(2|3|6)|5(2|4|9)|6(0|2|3|6)|7(0|4|8)|8(2|6|8)|9(0|4))|7(0(2|3|4|5|6)|1(0|6)|24|3(2|6)|4(0|4|8)|5(2|6)|6(0|4|8)|7(2|6)|8(0|4|8)|9(2|5|6|8))|8(0(0|4|7)|26|3(1|2|3|4)|40|5(0|8)|6(0|2)|76|8(2|7)|94))$ |
| Description |
Table:
http://en.wikipedia.org/wiki/ISO_3166-1. |
| Matches |
only country code (three digits) |
| Non-Matches |
others |
| Author |
Rating:
Not yet rated.
Juraj Hajdúch (SK)
|
| Title |
Test
Details
Social Security Number - All Rules Enforced
|
| Expression |
^((?!000)(?!666)(?:[0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-2]))-((?!00)\d{2})-((?!0000)\d{4})$ |
| Description |
Could not find a regex that truly matched the rules here http://en.wikipedia.org/wiki/Social_Security_number#Valid_SSNs So I modified an existing one to match the valid SSN rules.
The first digit set will not match:
000, 666, 734 to 749, and greater than 772.
* Numbers with all zeros in any digit group (000-xx-####, ###-00-####, ###-xx-0000) |
| Matches |
455-55-4444|333-22-1111|733-11-1111 |
| Non-Matches |
734-11-1111|749-11-1111|772-11-1111 |
| Author |
Rating:
Tim Cartwright
|
| Title |
Test
Details
Indonesian Cell Phone Number Validation
|
| Expression |
^((?:\+62|62)|0)[2-9]{1}[0-9]+$ |
| Description |
Validate Indonesian "Mobile Numbers Only" with or without the country code, also base on regular phone number format at http://id.wikipedia.org/wiki/Daftar_kode_telepon_di_Indonesia. This regex only allowed characters that accepted by mobile phone/sms gateway only :D |
| Matches |
+62817737669 | 62817737669 | 0817737669 | 6221995500 | 021995500 | 0401998866 |
| Non-Matches |
+817737669 | 817737669 | 00817737669 | 0817 737 669 | 0817-737-669 | 021-995500 |
| Author |
Rating:
Didi Yudhiarto walnutz.net
|
| Title |
Test
Details
Single Email Match - current June 2010
|
| Expression |
^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+(?:[a-zA-Z]{2}|aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel)$ |
| Description |
Matches email addresses. Based on expression at regular-expressions.info/email.html modified to include all top-level domains (TLD)listed on wikipedia as of June 2010. Needs to be updated as new TLDs are added.
Known Issues:
* IP Addresses will not validate
* Double "at" symbols, e.g. email@ [email protected] slip by this regex. Would welcome improvements by a regex ninja. |
| Matches |
|
| Non-Matches |
|
| Author |
Rating:
Brent Thomas
|
| Title |
Test
Details
National Drug Code
|
| Expression |
\d{4}-\d{4}-\d{2}|\d{5}-\d{3}-\d{2}|\d{5}-\d{4}-\d{1}|\d{5}-\*\d{3}-\d{2} |
| Description |
http://en.wikipedia.org/wiki/National_Drug_Code |
| Matches |
1234-5678-90 | 12345-678-90 | 12345-6789-0 | 49981-*007-01 |
| Non-Matches |
1234-56-8-90 | 123-45678-90 | 1-345-6789-0 |
| Author |
Rating:
Tom Struzik
|
| Title |
Test
Details
South African Landline numbers
|
| Expression |
^(?:(?:\(|)0|\+27|27)(?:1[12345678]|2[123478]|3[1234569]|4[\d]|5[134678])(?:\) | |-|)\d{3}(?: |-|)\d{4}$ |
| Description |
Limited by proper dialing codes as per http://en.wikipedia.org/wiki/Telephone_numbers_in_South_Africa. It will match phone numbers in most common formats that users normally type their phone number.
Tested with Perl engine regex in PHP. |
| Matches |
+27121234567 +2712 123 4567 012 123 4567 (012) 123 4567 (012) 123-4567 |
| Non-Matches |
27621234567 |
| Author |
Rating:
Ian van den Heuvel
|
| Title |
Test
Details
Email
|
| Expression |
^(([A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^_\`\{\|\}\~]+\.*)*[A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^_\`\{\|\}\~]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})$ |
| Description |
An email that should work in accordance to the RFC standard (see http://en.wikipedia.org/wiki/Email_address#Syntax) |
| Matches |
|
| Non-Matches |
|
| Author |
Rating:
Not yet rated.
Tim Gaunt
|
| Title |
Test
Details
URI checker
|
| Expression |
#^([a-z0-9+\-.]+):([/]{0,2}([a-z0-9\-._~%!\$&'\(\)\*+,;=:]+@)?([\[\]a-z0-9\-._~%!\$&'\(\)\*+,;=:]+(:[0-9]+)?))([a-z0-9\-._~%!\$&'\(\)\*+,;=:@/]*)(\?[\?/a-z0-9\-._~%!\$&'\(\)\*+,;=:@]+)?(\#[a-z0-9\-._~%!\$&'\(\)\*+,;=:@/\?]+)?#i |
| Description |
This is a Perl regular expression which matches any valid URI. I've extensively tested it (with the help of Wikipedia, and the actual URI specification written by Sir Tim Burners Lee himself), and it seems to work in all cases. Whether it will actually work to validate a URI is questionable... But any URI that is valid, will match. Including those with IPv6 addresses. |
| Matches |
ftp://ftp.is.co.za/rfc/rfc1808.txt | http://www.ietf.org/rfc/rfc2396.txt | ldap://[2001:db8::7]/c=GB?objectClass?one | mailto: [email protected] | news:comp.infosystems.www.servers.unix | tel:+1-816-555-1212 | telnet://192.0.2.16:80/ | urn:oasis:names:specification:docbook:dtd:xml:4.1.2 |
| Non-Matches |
asdf?fdjdf:blah | dskjf:///////blah | google.com |
| Author |
Rating:
Colin Griffith
|
| Title |
Test
Details
Mobile numbers in China
|
| Expression |
^(\+86)(13[0-9]|145|147|15[0-3,5-9]|18[0,2,5-9])(\d{8})$ |
| Description |
This expression is pretty simple. It validates for mobile phone numbers in mainland China. I needed phone numbers in a certain format for use with an SMS gateway. The formatting is rather strict.
Area codes taken from here: http://en.wikipedia.org/wiki/Telephone_numbers_in_China#Mobile_phones |
| Matches |
+8613812345678 | +8613012345678 | +8618212345678 |
| Non-Matches |
+8614012345678 | +8615412345678 | +8619012345678 |
| Author |
Rating:
Scott Crooks
|
| Title |
Test
Details
UK Telephone Format
|
| Expression |
^0(((1[0-9]{2}[ -]?[0-9]{3}[ -]?[0-9]{4})|(1[0-9]{3}[ -]?[0-9]{6})|(1[0-9]{4}[ -]?[0-9]{4,5}))|((1[0-9]1)|(11[0-9]))[ -]?[0-9]{3}[ -]?[0-9]{4}|(2[0-9][ -]?[0-9]{4}[ -]?[0-9]{4})|((20[ -]?[0-9]{4})|(23[ -]?[8,9][0-9]{3})|(24[ -]?7[0-9]{3})|(28[ -]?(25|28|37|71|82|90|92|95)[0-9]{2})|(29[ -]?2[0-9]))[ -]?[0-9]{4}|(7[4-9][0-9]{2}[ -]?[0-9]{6})|((3[0,3,4,7][0-9])[ -]?[0-9]{3}[ -]?[0-9]{4})|((5[5,6][ -]?[0-9]{4}[ -]?[0-9]{4})|(500[ -]?[0-9]{3}[ -]?[0-9]{4}))|(8[0247][0-9]{1}[ -]?[0-9]{3}[ -]?[0-9]{4})|(9[0-9]{2}[ -]?[0-9]{3}[ -]?[0-9]{4}))$ |
| Description |
Follows http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom
must have a specific length and be a valid telephone number in the UK
Must start with a 0, have included 01 02 03 05 08 numbers. character spacing have be " ", "-",
accepts 01 02 03 05 07 08 numbers, rejects everything else. |
| Matches |
020 1234 1234 | 020-1234-1234 | 02012341234 | 01234 123456 | 012345 1234 |
| Non-Matches |
0201 234 1234 | 0201-234-1234 | 0201234123 | 012341 23456 | 0123451 234 | 00000 000000 |
| Author |
Rating:
Not yet rated.
Craig Hughes
|
| Title |
Test
Details
ISO 8601 Time
|
| Expression |
^(?:[0-1][0-9]|[2][0-3]):?(?:[0-5][0-9]):?(?:[0-5][0-9]|60)|2400|24:00$ |
| Description |
Matches HH:MM:SS and HHMMSS as well as the special 24:00 and 2400 - check http://en.wikipedia.org/wiki/ISO_8601#Times for more data. |
| Matches |
01:01:01 11:01:01 21:01:01 24:00 |
| Non-Matches |
25:01:00 240000 |
| Author |
Rating:
Not yet rated.
Antony Kennedy
|
| Title |
Test
Details
UK Telephone Numbers
|
| Expression |
^(((\+|00)?44|0)([123578]{1}))(((\d{1}\s?\d{4}|\d{2}\s?\d{3})\s?\d{4})|(\d{3}\s?\d{2,3}\s?\d{3})|(\d{4}\s?\d{4,5}))$ |
| Description |
Validates UK phone numbers based on the Wikipedia page http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom including the international dialing code 0044/+44/44 |
| Matches |
0XX XXXX XXXX | 0XXX XXX XXXX | 0XXXX XXXXXX |
| Non-Matches |
04XXX XXXXXX | 06XXX XXXXXX | 0XXXXXXX |
| Author |
Rating:
Paul Verhulpen
|
Displaying page
of
pages;
Items to