134 regular expressions found in this category!
Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
^(?<From>(JANUARY|FEBRUARY|MARCH|APRIL|MAY|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER|[ ]|,|/|[0-9])+)(-|–|:|TO)?(?<To>(JANUARY|FEBRUARY|MARCH|APRIL|MAY|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER|[ ]|,|/|[0-9]|PRESENT)+)+(:)* |
Description |
This regular expression will match date given in any format expcept (mmm). Its speciality is that it divides dates into <from> part and <to> part. Use Groups to access these parts.
e.g. JANUARY 1998 TO JUNE 2000
<From>="JANUARY 1998"
<to>="JUNE 2000"
|
Matches |
JANUARY 2000 | 19-01-2000 | 12/11/2000 |
Non-Matches |
"Hello it is ordinary text" | "non -date text" |
Author |
Rating:
Not yet rated.
Manpreet Grewal
|
Title |
Test
Details
Pattern Title
|
Expression |
(((0[13578]|10|12)([-./])(0[1-9]|[12][0-9]|3[01])([-./])(\d{4}))|((0[469]|11)([-./])([0][1-9]|[12][0-9]|30)([-./])(\d{4}))|((2)([-./])(0[1-9]|1[0-9]|2[0-8])([-./])(\d{4}))|((2)(\.|-|\/)(29)([-./])([02468][048]00))|((2)([-./])(29)([-./])([13579][26]00))|((2)([-./])(29)([-./])([0-9][0-9][0][48]))|((2)([-./])(29)([-./])([0-9][0-9][2468][048]))|((2)([-./])(29)([-./])([0-9][0-9][13579][26]))) |
Description |
My meager attempt at a date validator with leap years using a strict mm/dd/yyyy format. |
Matches |
02/29/2084 | 01/31/2000 | 11/30/2000 |
Non-Matches |
02/29/2083 | 11/31/2000 | 01/32/2000 |
Author |
Rating:
Not yet rated.
Jason West
|
Title |
Test
Details
Pattern Title
|
Expression |
^((((([13578])|(1[0-2]))[\-\/\s]?(([1-9])|([1-2][0-9])|(3[01])))|((([469])|(11))[\-\/\s]?(([1-9])|([1-2][0-9])|(30)))|(2[\-\/\s]?(([1-9])|([1-2][0-9]))))[\-\/\s]?\d{4})(\s((([1-9])|(1[02]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$ |
Description |
This expression can be used validate a datetime column from SQL Server. Big parts of it where taken from other samples on RegexLib. Please feel free to take it apart and improve it. |
Matches |
3/3/2003 | 3/3/2002 3:33 pm | 3/3/2003 3:33:33 am |
Non-Matches |
13/1/2002 | 3/3/2002 3:33 | 31/3/2002 |
Author |
Rating:
Not yet rated.
Scott Watermasysk Watermasysk
|
Title |
Test
Details
Pattern Title
|
Expression |
^( [1-9]|[1-9]|0[1-9]|10|11|12)[0-5]\d$ |
Description |
Matches a 12-hour time value expressed as either 4 numeric digits, 3 numeric digits, or a space and 3 numeric digits. 3 digit times (930) can be expressed with leading 0's (0930) or not. AM/PM designation is not included in this expression. |
Matches |
1145 | 933 | 801 |
Non-Matches |
0000 | 1330 | 8:30 |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^([0-1][0-9]|[2][0-3]):([0-5][0-9])$ |
Description |
Matches a string if it is a valid time in the format of HH:MM |
Matches |
02:04 | 16:56 | 23:59 |
Non-Matches |
02:00 PM | PM2:00 | 24:00 |
Author |
Rating:
Not yet rated.
Koen Hoorelbeke
|
Title |
Test
Details
Pattern Title
|
Expression |
^((([0]?[1-9]|1[0-2])(:|\.)[0-5][0-9]((:|\.)[0-5][0-9])?( )?(AM|am|aM|Am|PM|pm|pM|Pm))|(([0]?[0-9]|1[0-9]|2[0-3])(:|\.)[0-5][0-9]((:|\.)[0-5][0-9])?))$ |
Description |
Matches times seperated by either : or . will match a 24 hour time, or a 12 hour time with AM or PM specified. Allows 0-59 minutes, and 0-59 seconds. Seconds are not required. |
Matches |
1:01 AM | 23:52:01 | 03.24.36 AM |
Non-Matches |
19:31 AM | 9:9 PM | 25:60:61 |
Author |
Rating:
Not yet rated.
Steve Valaitis
|
Title |
Test
Details
Pattern Title
|
Expression |
^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$ |
Description |
The following validates dates with and without leading zeros in the following formats: MM/DD/YYYY and it also takes YYYY (this can easily be removed). All months are validated for the correct number of days for that particular month except for February which can be set to 29 days. date day month year |
Matches |
01/01/2001 | 1/01/2001 | 2002 |
Non-Matches |
2/30/2002 | 13/23/2002 | 12345 |
Author |
Rating:
Not yet rated.
Matt Adams
|
Title |
Test
Details
Pattern Title
|
Expression |
((0[1-9])|(1[02]))/\d{2} |
Description |
Fromat check for MM/YY, checks month is 1-12 and any 2 digit year. |
Matches |
01/00 | 12/99 |
Non-Matches |
13/00 | 12/AS |
Author |
Rating:
Not yet rated.
Andrew Balaschak
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?: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])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$ |
Description |
This expression validates dates in the ITALIAN d/m/y format from 1/1/1600 - 31/12/9999. The days are validated for the given month and year. Leap years are validated for all 4 digits years from 1600-9999, and all 2 digits years except 00 since it could be any century (1900, 2000, 2100). Days and months must be 1 or 2 digits and may have leading zeros. Years must be 2 or 4 digit years. 4 digit years must be between 1600 and 9999. Date separator may be a slash (/), dash (-), or period (.)
Thanks to Michael Ash for US Version |
Matches |
29/02/1972 | 5-9-98 | 10-11-2002 |
Non-Matches |
29/02/2003 | 12/13/2002 | 1-1-1500 |
Author |
Rating:
Not yet rated.
Marco Storti
|
Title |
Test
Details
Pattern Title
|
Expression |
^(3[0-1]|2[0-9]|1[0-9]|0[1-9])[\s{1}|\/|-](Jan|JAN|Feb|FEB|Mar|MAR|Apr|APR|May|MAY|Jun|JUN|Jul|JUL|Aug|AUG|Sep|SEP|Oct|OCT|Nov|NOV|Dec|DEC)[\s{1}|\/|-]\d{4}$ |
Description |
More flexible date validator. Allows either spaces, / or - as dividers, also allows for fully uppercase months, year as 4 digit. |
Matches |
01 JAN 2003 | 31/Dec/2002 | 20-Apr-2003 |
Non-Matches |
32 Jan 2003 | 00 Dec 2003 | 10 dec 2003 |
Author |
Rating:
Not yet rated.
Ian Wallace
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((((0[13578])|([13578])|(1[02]))[\-\/\s]?((0[1-9])|([1-9])|([1-2][0-9])|(3[01])))|((([469])|(11))[\-\/\s]?((0[1-9])|([1-9])|([1-2][0-9])|(30)))|((02|2)[\-\/\s]?((0[1-9])|([1-9])|([1-2][0-9]))))[\-\/\s]?\d{4})(\s(((0[1-9])|([1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$ |
Description |
Following expression can be used to validate a datetime column from SQL Server. This expression is an enhanced version of Scott Watermasysk's date/time submission. It now accepts leading zeros in months, days, and hours. In addition, this expression properly handles the 11th hour. Watermasysk's would take the 10th and 12th hour but not the 11th. This regex has been tweaked to do so. Does not handle the February 29th problem on non-leap years yet. Will learn a little more about RegEx and do so in later submission.
|
Matches |
11/30/2003 10:12:24 am | 2/29/2003 08:14:56 pm | 5/22/2003 |
Non-Matches |
11/31/2003 10:12:24 am | 2/30/2003 08:14:56 pm | 5/22/2003 14:15 |
Author |
Rating:
Not yet rated.
David Darling
|
Title |
Test
Details
Pattern Title
|
Expression |
^\d{2}\s{1}(Jan|Feb|Mar|Apr|May|Jun|Jul|Apr|Sep|Oct|Nov|Dec)\s{1}\d{4}$ |
Description |
valid date base on Month |
Matches |
01 Jan 2003 |
Non-Matches |
01 01 2003 |
Author |
Rating:
Not yet rated.
stephen lam
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((0[13578]|10|12)([-./])(0[1-9]|[12][0-9]|3[01])([-./])(\d{4}))|((0[469]|11)([-./])([0][1-9]|[12][0-9]|30)([-./])(\d{4}))|((02)([-./])(0[1-9]|1[0-9]|2[0-8])([-./])(\d{4}))|((02)(\.|-|\/)(29)([-./])([02468][048]00))|((02)([-./])(29)([-./])([13579][26]00))|((02)([-./])(29)([-./])([0-9][0-9][0][48]))|((02)([-./])(29)([-./])([0-9][0-9][2468][048]))|((02)([-./])(29)([-./])([0-9][0-9][13579][26])))$ |
Description |
This works for all accept 01/01/0000 mainly 0000. can anybody suggest a solution. |
Matches |
01/01/2001 |
Non-Matches |
01/01/00000 |
Author |
Rating:
Not yet rated.
Func toid
|
Title |
Test
Details
Pattern Title
|
Expression |
^((((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9]))))[\-\/\s]?\d{2}(([02468][048])|([13579][26])))|(((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))[\-\/\s]?\d{2}(([02468][1235679])|([13579][01345789]))))(\s(((0?[1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$ |
Description |
This regex will match SQL Server datetime values, allowing date only, allowing zero padded digits in month, day and hour, and will match leap years from 1901 up until 2099. |
Matches |
2/29/2004 | 04/01/2003 10:01:23 am | 03-20-1999 |
Non-Matches |
2/29/2003 | 13/30/2001 10:05:00 pm | 12/32/2003 |
Author |
Rating:
Not yet rated.
Sung Lee
|
Title |
Test
Details
Pattern Title
|
Expression |
^[\w-\.]+@([\w-]+\.)+[\w-]{2,3}$ |
Description |
For Date format MM-JJ-YYYY validation
|
Matches |
|
Non-Matches |
umtsfr@free | umtsfrfree.fr | @free.fr |
Author |
Rating:
Not yet rated.
Hakim SALHI
|
Title |
Test
Details
Pattern Title
|
Expression |
^(([0]?[1-9]|1[0-2])/([0-2]?[0-9]|3[0-1])/[1-2]\d{3})? ?((([0-1]?\d)|(2[0-3])):[0-5]\d)?(:[0-5]\d)? ?(AM|am|PM|pm)?$ |
Description |
Matches variations on date/time/AM-PM. Must have 4 digit year, but everything else is open. Restrictions are: 4 digit year, months 1-12, hours 1-23, minutes and seconds 1-59, any case of AM and PM. If this don't woik, I wrote it, lemmy know. |
Matches |
12/30/2002 | 12/30/2002 9:35 pm | 12/30/2002 19:35:02 |
Non-Matches |
18/22/2003 | 8/12/99 | 8/22/2003 25:00 |
Author |
Rating:
Not yet rated.
Michael Gaertner
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?:(?:(?:0?[1-9]|1\d|2[0-8])\/(?:0?[1-9]|1[0-2]))\/(?:(?:1[6-9]|[2-9]\d)\d{2}))$|^(?:(?:(?:31\/0?[13578]|1[02])|(?:(?:29|30)\/(?:0?[1,3-9]|1[0-2])))\/(?:(?:1[6-9]|[2-9]\d)\d{2}))$|^(?:29\/0?2\/(?:(?:(?:1[6-9]|[2-9]\d)(?:0[48]|[2468][048]|[13579][26]))))$ |
Description |
This expression validates dates in the Brazilian d/m/y format from 1/1/1600 - 12/31/9999. The days are validated for the given month and year. Leap years are validated for all 4 digits years from 1600-9999. Days and months must be 1 or 2 digits and may have leading zeros. Years must be 4 digit years, between 1600 and 9999. Date separator must be a slash (/) |
Matches |
29/02/2004 | 15/3/1824 | 31/01/2001 |
Non-Matches |
29/02/2000 | 21/10/92 | 31/02/2001 |
Author |
Rating:
Not yet rated.
Felipe Braga
|
Title |
Test
Details
Pattern Title
|
Expression |
^(\d{1,2})(\s?(H|h)?)(:([0-5]\d))?$ |
Description |
Validates hours and minutes. Allows for entry in the form of hours:minutes with optional minutes and optional hours indicator (H or h). |
Matches |
1h | 1:45 | 45 |
Non-Matches |
1a | 145 | 1:99 |
Author |
Rating:
Not yet rated.
Andrew Yeaman
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((\d{4}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|((\d{2}[02468][048]|\d{2}[13579][26]))0229)){0,8}$ |
Description |
Validates a date expression (or empty value) in CCYYMMDD format, checking a leap year from 00000101 A.D. to 99991231 |
Matches |
20041231 | 20040229 |
Non-Matches |
20043112 | 2003/04/02 |
Author |
Rating:
Not yet rated.
Danny Garber
|
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
|
Displaying page
of
pages;
Items to