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

Please support RegExLib Sponsors

Sponsors

Expressions by User

Change page:   |    Displaying page 2 of 3 pages; Items 21 to 40
Title Test Details Social Security Number
Expression
^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$
Description
This regex validates U.S. social security numbers, within the range of numbers that have been currently allocated.
Matches
078-05-1120 | 078 05 1120 | 078051120
Non-Matches
987-65-4320 | 000-00-0000 | (555) 555-5555
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
(?i:([A-D])(?!\1)([A-D])(?!\1|\2)([A-D])(?!\1|\2|\3)([A-D]))
Description
This regex validates a string of non-repeating characters A, B, C, D.
Matches
abcd | dbca | badc
Non-Matches
abba | baaa | cabb
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^(?=[^\d_].*?\d)\w(\w|[!@#$%]){7,20}
Description
This regex can be used to restrict passwords to a length of 8 to 20 aplhanumeric characters and select special characters. The password also can not start with a digit, underscore or special character and must contain at least one digit.
Matches
password1 | pa$$word2 | pa!@#$%3
Non-Matches
password | 1stpassword | $password#
Author Rating: The rating for this expression. Michael Ash
Title Test Details yyyy/mm/dd hhMMss Date
Expression
^(?ni:(?=\d)((?'year'((1[6-9])|([2-9]\d))\d\d)(?'sep'[/.-])(?'month'0?[1-9]|1[012])\2(?'day'((?<!(\2((0?[2469])|11)\2))31)|(?<!\2(0?2)\2)(29|30)|((?<=((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00)\2\3\2)29)|((0?[1-9])|(1\d)|(2[0-8])))(?:(?=\x20\d)\x20|$))?((?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2}))?)$
Description
YYYY/MM/DD hh:mm:ss format DateTime Regex. This regex will validate a date, time or a datetime. It will also capture the date fields and the time. Dates are in the YYYY/MM/DD 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(/) 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. Please refer to http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx for additional info Datetime is the above date and time formats separated by a space, with the date first (YYYY/MM/DD hh:mm:ss) !IMPORTANT NOTE: your regex engine must support lookbehinds and named groups to use this expression
Matches
12:30 PM | 2004-02-29 | 2004/3/31 02:31:35 AM
Non-Matches
2:00 | 2200.2.29 | 0000/00/00 00:00:00 AM
Author Rating: The rating for this expression. Michael Ash
Title Test Details Currency
Expression
^(?!\u00a2) #Don't allow cent symbol \p{Sc}? #optional unicode currency symbols (?!0,?\d) #don't allow leading zero if 1 or more unit (\d{1,3} # 1 to 3 digits (\,\d{3})* # if the is a comma it must be followed by 3 digits |(\d+)) # more than 3 digit with no comma separator (\.\d{2})?$ # option cents
Description
This regex validates Currency. The base monetary unit (ex. US dollar) followed by option two digit cent denomination. Base unit can't have leading zero. Comma's are optional on base units. Note: Your regex engine must support the \p character class to use this. For example this will work in .net but not javascript which doesn't support \p Also the &#162; is removed from the match by force. Any other cent symbol would need to be added to the exclude to not match.
Matches
$1,501.13 | &#163;215 | €4.93
Non-Matches
01.00 | $.00 | &#162;50
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$
Description
DateTime Validator. This RE validates both dates and/or times patterns. Days in Feb. are also validated for Leap years. Dates: in dd/mm/yyyy or d/m/yy format between 1/1/1600 - 31/12/9999. Leading zeroes are optional. Date separators can be either matching dashes(-), slashes(/) or periods(.) Times: in the hh:MM:ss AM/PM 12 hour format (12:00 AM - 11:59:59 PM) or hh:MM:ss military time format (00:00:00 - 23:59:59). The 12 hour time format: 1) may have a leading zero for the hour. 2) Minutes and seconds are optional for the 12 hour format 3) AM or PM is required and case sensitive. Military time 1) must have a leading zero for all hours less than 10. 2) Minutes are manditory. 3) seconds are optional. Datetimes: combination of the above formats. A date first then a time separated by a space. ex) dd/mm/yyyy hh:MM:ss This RE is an variation of one of my other Datetime (mm/dd/yyyy) validator already in this library http://www.regexlib.com/REDetails.aspx?regexp_id=369, so the same rules for leap year apply. All 4 digit year and all two digit years except 00, which might not be a leap year.
Matches
31/12/2003 11:59:59 PM | 29-2-2004 | 01:45:02
Non-Matches
12/31/2003 | 29.02.2005 | 13:30 PM
Author Rating: The rating for this expression. Michael Ash
Title Test Details Quoted string
Expression
^(\x22|\x27)((?!\1).|\1{2})*\1$
Description
The regex validate a quoted string in VBScript or Ansi SQL. The string may contain the containing quote character if it is escaped by being doubled up. In VB/VBScript two double quotes within a string enclosed in double qoutes translate into one double quote within the string In SQL two single quotes within a string enclosed in single qoutes translate into one single quote within the string
Matches
"To quote Yoda (""Do, or do not. There is no 'try'"" )"
Non-Matches
'This won't validate' | "He said "Ok.""
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
,(?!(?<=(?:^|,)\s*\x22(?:[^\x22]|\x22\x22|\\\x22)*,)(?:[^\x22]|\x22\x22|\\\x22)*\x22\s*(?:,|$))
Description
This regex can be used to split the values of a comma delimitted list. List elements may be quoted, unquoted or empty. Commas inside a pair of quotation marks are not matched.
Matches
1,,3""but, wait",5 | 1,2,3
Non-Matches
"Test""a,b,c,d""ing" | no comma | semi; colon
Author Rating: The rating for this expression. Michael Ash
Title Test Details Enitity notation
Expression
& (?ni:\# # if a pound sign follow ampsand look for number ((x # if x follow pound sign accept hex value up to 5 digits ([\dA-F]){1,5} ) | # otherwise accept decimal number between 0 - 1048575 (104857[0-5] |10485[0-6]\d |1048[0-4]\d\d |104[0-7]\d{3} |10[0-3]\d{4} |0?\d{1,6}) ) | # no pound sign after ampersand ([A-Za-z\d.]{2,31}) #accept ASCII alphanumeric and period ); #end with semi-colon.
Description
This regex can be used to find general entites in HTML, XML and SGML files. The entity can consist of 1) an ampsand (&amp;) 2) followed by (a) ASCII alphanumerics or period between 2 and 31 characters or (b) a pound sign # (i) followed by an x followed by a unicode value up to 5 hex digits or (ii) followed by a decimal value from 0 to 1048575 3) ending with a semi-colon (;)
Matches
&quote; | &#169; | &#x00027;
Non-Matches
& | &#Hello; | &#Xray;
Author Rating: The rating for this expression. Michael Ash
Title Test Details mm/dd/yyyy Julian and Gregrian Datetime
Expression
(?#Calandar from January 1st 45 BC to December 31, 9999 in mm/dd/yyyy format) (?! (?:10(?<sep>[-./])(?:0?[5-9]|1[0-4])\k<sep>(?:1582))| #Missing days from 1582 (?:0?9(?<sep>[-./])(?:0?[3-9]|1[0-3])\k<sep>(?:1752)) #or Missing days from 1752 (?# both sets of missing days such not be in the same calendar so remove one or the other) ) (?n:^(?=\d) # the character at the beginning a the sring must be a digit ( (?<month> (0?[13578])|1[02]| #months with 31 days (0?[469]|11)(?!.31)| # months with 30 days 0?2 # February (?(.29) # if feb 29th check for valid leap year (?=.29. (?! #exclude these years from leap year pattern 000[04] #No year 0 and no leap year in year 4 | (?:(?:1[^0-6]|[2468][^048]|[3579][^26])00) (?# centurial years > 1500 not evenly divisible by 400 are not leap year) ) (?:(?:(?:\d\d) # century (?:[02468][048]|[13579][26]) #leap years (?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC)) )| # else if not Feb 29 (?!.3[01]) # and day not Feb 30 or 31 ) #end Leap year check ) #end of month check (?<sep>[-./]) # choose a date separator (?<day>0?[1-9]|[12]\d|3[01]) #days between 1-31 (?# The maximum number of days allowed for a month has already been checked for in the month check. If you made it this far the number of day is within the range for the given month) \k<sep> # Match the same date separator choosen before. (?!0000) # There is no year 0 (?<year>(?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?:\z|(?:\x20\d))))\d{4}(?:\x20BC)? # a four digit year. Use leading zeros if needed ) (?(?=\x20\d)\x20|$))? # if there is a space followed by a digit check for time (?<time> ( # 12 hour format (0?[1-9]|1[012]) # hours (:[0-5]\d){0,2} # optional minutes and seconds (?i:\x20[AP]M) # required AM or PM )| # 24 hour format ( [01]\d|2[0-3]) #hours (:[0-5]\d){1,2}) #required minutes optional seconds ?$)
Description
Datetime for Julian and Gregorian Calenders Matchs dates from 0001 A.D. to 9999 A.D. Days and months are 1 or 2 digits Years are 4 digit with leading zeros if required. February is validate in all leap years Leap year rules for Julian and Gregorian calendars (http://scienceworld.wolfram.com/astronomy/LeapYear.html) Missing days for 1582 and 1752 are not matched. Though only one set should be applied to a calendar since they are caused by when the calendar was adopted Missing days (http://scienceworld.wolfram.com/astronomy/GregorianCalendar.html) Time can be either 12 or 24 hour format 12 hour format hh:MM:ss AM|PM minutes and seconds are optional 24 hour format hh:mm:ss seconds are optional, hours less than ten require leading zero Datetome format is a date, a space then a time.
Matches
12/25/0004 | 12/31/0001 BC 2:15 AM | 2-29-2004 09:00
Non-Matches
00/00/0000 | 2-29-2100 | 10/8/1582
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
\p{IsBasicLatin}
Description
Matches any character is the Basic Latin Unicode Range \U0000-U007F (Ascii 0-127) I've blogged about this and other expressions here http://blogs.regexadvice.com/mash/archive/2004/04/17/988.aspx
Matches
ABCxyz | 123 | +-=
Non-Matches
? | ? | ?
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
\p{N}
Description
Matches numbers. Note: the second match (?) and the second non-match (IV) are not the same. I cover this in more detail here http://blogs.regexadvice.com/mash/archive/2004/04/17/988.aspx
Matches
123890 | ? | &#189;
Non-Matches
AAABB | IV | Ten
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
\p{Sm}
Description
Math Symbols. NOTE: the second examples of match and non-match are not the same. The non-match is the keyboard dash. The match is the unicode minus sign.
Matches
+= | - | &#177; v =
Non-Matches
1 | - | 1x2
Author Rating: Not yet rated. Michael Ash
Title Test Details dd/mm/yyyy hhMMss Julian to Gregorian DateTime
Expression
(?#Datetime for Julian and Gregorian Calenders Matchs dates from 0045 BC to 9999 A.D. Days and months are 1 or 2 digits Years are 4 digit with leading zeros if required. February is validate in all leap years Leap year rules for Julian and Gregorian calendars http://scienceworld.wolfram.com/astronomy/LeapYear.html Missing days for 1582 and 1752 are not matched. Though only one set should be applied to a calendar since they are caused by when the calendar was adopted Missing days http://scienceworld.wolfram.com/astronomy/GregorianCalendar.html Time can be either 12 or 24 hour format 12 hour format hh:MM:ss AM|PM minutes and seconds are optional 24 hour format hh:mm:ss seconds are optional, hours less than ten require leading zero Datetome format is a date, a space then a time. ) (?#Calandar from January 1st 45 B.C. to December 31, 1999 in dd/mm/yyyy format) (?! (?:(?:0?[5-9]|1[0-4])(?<sep>[-./])10\k<sep>(?:1582))| #Missing days from 1582 (?:(?:0?[3-9]|1[0-3])(?<sep>[-./])0?9\k<sep>(?:1752)) #or Missing days from 1752 (?# both sets of missing days such not be in the same calendar so remove one or the other) ) (?n:^(?=\d) # the character at the beginning a the sring must be a digit ( (?<day>31(?!.0?[2469]|11)|30(?!.0?2)| 29(?(.0?2)(?=.0?2.(?! #exclude these years from leap year pattern 000[04] #No year 0 and no leap year in year 4 | (?:(?:1[^0-6]|[2468][^048]|[3579][^26])00) (?# centurial years > 1500 not evenly divisible by 400 are not leap year) ) (?:(?:(?:\d\d) # century (?:[02468][048]|[13579][26]) #leap years (?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC)))|(?!.0?2))| 2[0-8]|1\d|0?[1-9]) (?<sep>[-./]) # choose a date separator (?<month> (0?[1-9])|1[012]) #end of month check (?# The maximum number of days allowed for a month has already been checked for in the month check. If you made it this far the number of day is within the range for the given month) \k<sep> # Match the same date separator choosen before. (?<year>(?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?:\z|(?:\x20\d))))\d{4}(?:\x20BC)? # a four digit year. Use leading zeros if needed ) (?(?=\x20\d)\x20|$))? # if there is a space followed by a digit check for time (?<time> ( # 12 hour format (0?[1-9]|1[012]) # hours (:[0-5]\d){0,2} # optional minutes and seconds (?i:\x20[AP]M) # required AM or PM )| # 24 hour format ( [01]\d|2[0-3]) #hours (:[0-5]\d){1,2}) #required minutes optional seconds ?$)
Description
dd-mm-yyyy Datetime for AD, with leap year. See http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx for details on this and similar regexs
Matches
30-4-2004 | 29/2/2004 3:35 PM | 23:00:00
Non-Matches
1/31/2004 | 23:23 AM | 29/2/2005
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
(?-i:\b\p{Ll}+\b)
Description
This pattern matches lower-case letters
Matches
test | hol&#227; | p
Non-Matches
Test | 123 | ?S
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
(?-i:\b\p{Lu}+\b)
Description
Matches uppercase unicode alpha characters
Matches
ABCDE | ??G?? | Æ
Non-Matches
abc | aß?d | æ
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^\d?\d'(\d|1[01])&quot;$
Description
Height notation for feet (') and inches(&quot;)
Matches
6'3&quot; | 5'11&quot; | 10'0&quot;
Non-Matches
9 Feet 2 inches | 5'12&quot; | 5'2 1/2&quot;
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^(?n:(?!-[\d\,]*K) (?!-((\d{1,3},)*((([3-9]\d\d|2[89]\d|27[4-9])\xB0C)|(((4[6-9]|[5-9]\d)\d)\xB0F)))) -?\d{1,3}(,\d{3})*(\xB0[CF]|K) )$
Description
Temperature scale. From ABSOLUTE ZERO up. Can use the Fahrenheit, Celsius or Kelvin Scale. The Degree symbol is required for Fahrenheit and Celsius. Numbers over 1,000 must be comma delimited.
Matches
32&#176;F | -10&#176;C | 4,000K
Non-Matches
-460&#176;F | 1000&#176;C | -1&#176;K
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
([2-9JQKA]|10)([\u2660\u2663\u2665\u2666])
Description
Matches each card in the deck of standard playing cards, not including the Jokers
Matches
A?A?A?A? | 2?3?4?5? | 10?J?Q?K?
Non-Matches
1? | 11? | R?
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^(?!\u00a2) #Don't allow cent symbol \p{Sc}? #optional unicode currency symbols (?!0,?\d) #don't allow leading zero if 1 or more unit (?:\d{1,3} # 1 to 3 digits (?:([, .])\d{3})? # if there is a separator it must be followed by 3 digits (?:\1\d{3})* # if the is more than two groups the same separtor must but used, it must be followed by 3 digits |(?:\d+)) # more than 3 digit with no comma separator ((?!\1)[,.]\d{2})?$ # option cents
Description
Internationally capable currency formats. It is NOT local aware. Should be modify for local specific validations. More detail at http://blogs.regexadvice.com/mash/archive/2004/06/08/1246.aspx
Matches
$9,876,543.21 | €9 876 543,21 | €9.876.543,21
Non-Matches
9.876.543.21 | 9,876,543,21 | 9 876 543 21
Author Rating: Not yet rated. Michael Ash
Change page:   |    Displaying page 2 of 3 pages; Items 21 to 40

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