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

Please support RegExLib Sponsors

Sponsors

Expressions by User

Change page:   |    Displaying page 1 of 3 pages; Items 1 to 20
Title Test Details M/d/y Date
Expression
^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[13-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$
Description
This expression validates dates in the US m/d/y format from 1/1/1600 - 12/31/9999.
Matches
01.1.02 | 11-30-2001 | 2/29/2000
Non-Matches
02/29/01 | 13/01/2002 | 11/00/02
Author Rating: The rating for this expression. Michael Ash
Title Test Details US currency
Expression
^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$
Description
This re matches US currency format with lead dollar sign. Dollar value must have at least one digit and may or may not be comma separated. Cents value is optional.
Matches
$0.84 | $123458 | $1,234,567.89
Non-Matches
$12,3456.01 | 12345 | $1.234
Author Rating: The rating for this expression. Michael Ash
Title Test Details Roman numerials
Expression
^(?i:(?=[MDCLXVI])((M{0,3})((C[DM])|(D?C{0,3}))?((X[LC])|(L?XX{0,2})|L)?((I[VX])|(V?(II{0,2}))|V)?))$
Description
This RE validates alpha characters that evaluate to Roman numerials, ranging from 1(I) - 3999(MMMCMXCIX). Not case sensitive.
Matches
III | xiv | MCMXCIX
Non-Matches
iiV | MCCM | XXXX
Author Rating: Not yet rated. Michael Ash
Title Test Details Text Extension
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(txt|TXT)$
Description
This RE validates a path/file of type txt (text file) This RE can be used as a filter on certain file types, while insuring the entire string is a fully qualified path and file. The filter value can be changed or added to as you need
Matches
c:\file.txt | c:\folder\sub folder\file.txt | \\network\folder\file.txt
Non-Matches
C: | C:\file.xls | folder.txt
Author Rating: Not yet rated. Michael Ash
Title Test Details yy/mm/dd Date
Expression
^(?:(?:(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\/|-|\.)(?:0?2\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\d)?\d{2})(\/|-|\.)(?:(?:(?:0?[13578]|1[02])\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\2(?:0?[1-9]|1\d|2[0-8]))))$
Description
This expression validates dates in the y/m/d format from 1600/1/1 - 9999/12/31. Follows the same validation rules for dates as my other date validator (m/d/y format) located in this library.
Matches
04/2/29 | 2002-4-30 | 02.10.31
Non-Matches
2003/2/29 | 02.4.31 | 00/00/00
Author Rating: The rating for this expression. Michael Ash
Title Test Details DateTime M/d/y hh:mm:ss
Expression
^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$
Description
DateTime Validator.
Matches
12/25/2003 | 08:03:31 | 02/29/2004 12 AM
Non-Matches
02/29/2003 1:34 PM | 13:23 PM | 24:00:00
Author Rating: The rating for this expression. Michael Ash
Title Test Details Time
Expression
^((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))$|^([01]\d|2[0-3])(:[0-5]\d){0,2}$
Description
This RE validates times patterns.
Matches
1 AM | 23:00:00 | 5:29:59 PM
Non-Matches
13 PM | 13:60:00 | 00:00:00 AM
Author Rating: The rating for this expression. Michael Ash
Title Test Details Days of the week
Expression
^(Sun|Mon|(T(ues|hurs))|Fri)(day|\.)?$|Wed(\.|nesday)?$|Sat(\.|urday)?$|T((ue?)|(hu?r?))\.?$
Description
This RE matches Days of the week or their abbreviations.
Matches
Sunday | Mon | Tu
Non-Matches
day | Wedday | Payday
Author Rating: The rating for this expression. Michael Ash
Title Test Details MMM dd, yyyy Date
Expression
^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\ (0?[1-9]|([12]\d)|30))|(Feb(ruary)?\ (0?[1-9]|1\d|2[0-8]|(29(?=,\ ((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))))\,\ ((1[6-9]|[2-9]\d)\d{2}))
Description
This RE validate Dates in the MMM dd, yyyy format from Jan 1, 1600 to Dec 31, 9999. The format is as follows: The name or 3 letter abbreivation, without a period, of the month, then a space then the day value then a comma then a space finally the year. The correct number of day are validated for each month include leap years. The name of month is case sensitive.
Matches
Jan 1, 2003 | February 29, 2004 | November 02, 3202
Non-Matches
Feb 29, 2003 | Apr 31, 1978 | jan 33,3333
Author Rating: The rating for this expression. Michael Ash
Title Test Details dd MMM yyyy Date
Expression
^((31(?!\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\b|t)t?|Nov)(ember)?)))|((30|29)(?!\ Feb(ruary)?))|(29(?=\ Feb(ruary)?\ (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\b|t)t?|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2})$
Description
This RE validates dates in the dd MMM yyyy format. Spaces separate the values.
Matches
31 January 2003 | 29 March 2004 | 29 Feb 2008
Non-Matches
Jan 1 2003 | 31 Sept 2003 | 29 February 2003
Author Rating: The rating for this expression. Michael Ash
Title Test Details Months
Expression
^(?:J(anuary|u(ne|ly))|February|Ma(rch|y)|A(pril|ugust)|(((Sept|Nov|Dec)em)|Octo)ber)$
Description
This RE validate the full name of the months.
Matches
January | May | October
Non-Matches
Jan | Septem | Octo
Author Rating: The rating for this expression. Michael Ash
Title Test Details XML Tag
Expression
<(\w+)(\s(\w*=".*?")?)*((/>)|((/*?)>.*?</\1>))
Description
This RE will match XML tag elements. All elements must be closed. Won't match nested tags
Matches
&lt;body&gt; text&lt;br/&gt;More Text &lt;/body&gt; | &lt;a href=&quot;link.html&quot;&gt;Link&lt;/a
Non-Matches
&lt;p&gt; Some Text &lt;p&gt; | &lt;hr&gt; | &lt;html&gt;
Author Rating: The rating for this expression. Michael Ash
Title Test Details ISBN-10
Expression
ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$
Description
This RE validates the format of an ISBN number
Matches
ISBN 0 93028 923 4 | ISBN 1-56389-668-0 | ISBN 1-56389-016-X
Non-Matches
123456789X | ISBN 9-87654321-2 | ISBN 123 456-789X
Author Rating: Not yet rated. Michael Ash
Title Test Details State Codes
Expression
^(?-i:A[LKSZRAEP]|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])$
Description
The RE match U.S. state abbreviation used by the U.S. Post Office.
Matches
AL | CA | AA
Non-Matches
New York | California | ny
Author Rating: The rating for this expression. Michael Ash
Title Test Details U.S. Street Address
Expression
^(?n:(?<address1>(\d{1,5}(\ 1\/[234])?(\x20[A-Z]([a-z])+)+ )|(P\.O\.\ Box\ \d{1,5}))\s{1,2}(?i:(?<address2>(((APT|B LDG|DEPT|FL|HNGR|LOT|PIER|RM|S(LIP|PC|T(E|OP))|TRLR|UNIT)\x20\w{1,5})|(BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR)\.?)\s{1,2})?)(?<city>[A-Z]([a-z])+(\.?)(\x20[A-Z]([a-z])+){0,2})\, \x20(?<state>A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADL N]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD] |T[NX]|UT|V[AIT]|W[AIVY])\x20(?<zipcode>(?!0{5})\d{5}(-\d {4})?))$
Description
captures US street address. Address format: ##### Street 2ndunit City, ST zip+4 address1 - must have street number and proper case street name. no punctuation or P.O Box #### punctuation manditory for P.O. address2 - optional secondary unit abbr. Secondary range required for some units. City - Proper case city name. State - State abbreviation. All caps zip - zip+4. Can't be all zeroes Abbreviations for secondary units and States are those used by the US Postal Service. http://www.usps.com/ncsc/lookups/usps_abbreviations.html Certain secondary units require a secondary range, see the above link THis RE isn't unbreakable, Probably will allow some false positives but should work for most addresses.
Matches
123 Park Ave Apt 123 New York City, NY 10002 | P.O. Box 12345 Los Angeles, CA 12304
Non-Matches
123 Main St | 123 City, State 00000 | 123 street city, ST 00000
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^(?n:(?<lastname>(St\.\ )?(?-i:[A-Z]\'?\w+?\-?)+)(?<suffix>\ (?i:([JS]R)|((X(X{1,2})?)?((I((I{1,2})|V|X)?)|(V(I{0,3})))?)))?,((?<prefix>Dr|Prof|M(r?|(is)?)s)\ )?(?<firstname>(?-i:[A-Z]\'?(\w+?|\.)\ ??){1,2})?(\ (?<mname>(?-i:[A-Z])(\'?\w+?|\.))){0,2})$
Description
This pattern captures &lt;lastname&gt;&lt;suffix&gt;,&lt;prefix&gt;&lt;firstname&gt;&lt;mname&gt; Names must start with a capital letter. Last names may be hyphenated. First names can have two parts ie &quot;Mary Anne&quot; if there are more than two names after the comma. Suffixes can number up to XXX (30th). Standard prefixes are optional (Mr Miss)
Matches
O'Brien, Miles | McDonald,Mary Ann Alison | Windsor-Smith,Barry
Non-Matches
jones, john
Author Rating: The rating for this expression. Michael Ash
Title Test Details mm/dd/yyyy hh:MM:ss AM/PM DateTime
Expression
(?n:^(?=\d)((?<month>(0?[13578])|1[02]|(0?[469]|11)(?!.31)|0?2(?(.29)(?=.29.((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|(?!.3[01])))(?<sep>[-./])(?<day>0?[1-9]|[12]\d|3[01])\k<sep>(?<year>(1[6-9]|[2-9]\d)\d{2})(?(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$)
Description
New DateTime Regex. Rebuilt better than before, better, stronger, faster.
Matches
1/31/2002 10 AM | 2/29/2004 | 4:15:04 PM
Non-Matches
2/29/2003 | 12/32/2003 | 4:00
Author Rating: The rating for this expression. Michael Ash
Title Test Details dd/mm/yyyy hh:MM:ss Datetime
Expression
(?n:^(?=\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(?<sep>[/.-])(?<month>0?[1-9]|1[012])\2(?<year>(1[6-9]|[2-9]\d)\d{2})(?:(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$)
Description
DD/MM/YYYY format New DateTime Regex. Rebuilt better than before, better, stronger, faster. This regex will validate a date, time or a datetime. It will also capture the date fields and the time. Dates are in the DD/MM/YYYY format and validated for months, number of days in a month and leap years (29/2) Date field can be separated by matched periods(.), dashes(-) or forward slashes(/). Year range 1600-9999 Time is either 12 hour AM/PM format (HH:mm:ss AM), where minutes and seconds are optional. AM or PM required. or 24 hour military format (HH:mm:SS), from 00:00:00 to 23:59:59, where hours and minutes fields are required, including leading 0 for hours less than 10. Datetime is the above date and time formats separated by a space, with the date first (DD/MM/YYYY HH:mm:SS) !IMPORTANT NOTE: your regex engine must support lookaheads and named groups to use this expression
Matches
31/12/2003 | 29/2/2004 4:50 PM | 23:59:59
Non-Matches
12/31/2003 | 29/2/2003 | 4:00
Author Rating: Not yet rated. Michael Ash
Title Test Details HTML 4.01 Elements
Expression
(<\/?)(?i:(?<element>a(bbr|cronym|ddress|pplet|rea)?|b(ase(font)?|do|ig|lockquote|ody|r|utton)?|c(aption|enter|ite|(o(de|l(group)?)))|d(d|el|fn|i(r|v)|l|t)|em|f(ieldset|o(nt|rm)|rame(set)?)|h([1-6]|ead|r|tml)|i(frame|mg|n(put|s)|sindex)?|kbd|l(abel|egend|i(nk)?)|m(ap|e(nu|ta))|no(frames|script)|o(bject|l|pt(group|ion))|p(aram|re)?|q|s(amp|cript|elect|mall|pan|t(r(ike|ong)|yle)|u(b|p))|t(able|body|d|extarea|foot|h|itle|r|t)|u(l)?|var))(\s(?<attr>.+?))*>
Description
This RE will match all the valid elements in HTML 4.01
Matches
<HTML> | <a href="link.html">Link</a>
Non-Matches
<xml> | <phonytag> | <image>
Author Rating: The rating for this expression. Michael Ash
Title Test Details (X)HTML click events
Expression
(?i:on(blur|c(hange|lick)|dblclick|focus|keypress|(key|mouse)(down|up)|(un)?load|mouse(move|o(ut|ver))|reset|s(elect|ubmit)))
Description
This regex will match all the valid on event attributes in HTML 4.01/XHTML 1.0
Matches
onclick | onsubmit | onmouseover
Non-Matches
click | onandon | mickeymouse
Author Rating: The rating for this expression. Michael Ash
Change page:   |    Displaying page 1 of 3 pages; Items 1 to 20

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