Title: Amazing. was looking for this kind of RegExp for 20 minutes now
Name: Jacob Dvir - ~ Yuki
Date: 8/30/2010 5:00:35 AM
Comment:
since i know it will take me a lot of time to develop this myself.
was really useful1!
Title: Broken
Name: Carlo
Date: 8/30/2010 4:55:31 AM
Comment:
Fails to match leap years 1600, 2000, 2400 ....
Title: Date time regex help required
Name: Vikas s
Date: 11/16/2009 10:57:33 AM
Comment:
hello I am looking for help with regex expression. I just started to use Regex today and have to parse a date time in the following format.
MON NOV 16 16:06:02 2009
Please help me asap!
Title: Date time regex help required
Name: Vikas s
Date: 11/16/2009 10:21:00 AM
Comment:
hello I am looking for help with regex expression. I just started to use Regex today and have to parse a date time in the following format.
MON NOV 16 16:06:02 2009
Please help me asap!
Title: Date time regex help required
Name: Vikas s
Date: 11/16/2009 10:20:48 AM
Comment:
hello I am looking for help with regex expression. I just started to use Regex today and have to parse a date time in the following format.
MON NOV 16 16:06:02 2009
Please help me asap!
Title: HEY YOUR PIECE OF CRAP STRING DOES NOT WORK
Name: ASSHOLE
Date: 1/2/2009 6:30:23 PM
Comment:
TRIED YOU STRING IN FOUR DIFFERENT APPLICATION AND SOURCE CODE AND IT FAILS EVERYTIME
U SUPID AHOLE
Title: great regex
Name: Sujith Mysore
Date: 12/17/2008 8:30:06 PM
Comment:
Great regex for the date time.. works like a charm!!!
Title: Broken
Name: JB
Date: 12/12/2008 3:59:31 PM
Comment:
doesn't think 12/24/2008 is a date
Title: how and where
Name: sonia kapoor
Date: 8/13/2008 3:52:11 AM
Comment:
I have an aspx page with two textboxes for entering dates.I want it to validate for a valid date.say for leap year, months which donot have 31 days should not be submitted. regular expression(description given below) suggested by you for the format dd-MM-yyyy is exactly what I want. But as I dont know about creating regular expresion I dont what the above expression means. I have used a RegularExpressionValidator as follows:
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtFromDate"
ErrorMessage='"Invalid Date"' ValidationExpression="(?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})?$)"></asp:RegularExpressionValidator>.
Please go through and suggest if I have missed something because it gives me an error if I enter 29-02-2008, and also for any other date.eg 12-06-2009.(even if valid).
Please help me get this.
Title: how and where
Name: sonia kapoor
Date: 8/13/2008 3:51:07 AM
Comment:
I have an aspx page with two textboxes for entering dates.I want it to validate for a valid date.say for leap year, months which donot have 31 days should not be submitted. regular expression(description given below) suggested by you for the format dd-MM-yyyy is exactly what I want. But as I dont know about creating regular expresion I dont what the above expression means. I have used a RegularExpressionValidator as follows:
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtFromDate"
ErrorMessage='"Invalid Date"' ValidationExpression="(?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})?$)"></asp:RegularExpressionValidator>.
Please go through and suggest if I have missed something because it gives me an error if I enter 29-02-2008, and also for any other date.eg 12-06-2009.(even if valid).
Please help me get this.
Title: No of Hours Reg Exp
Name: Eswar
Date: 7/1/2008 9:46:11 AM
Comment:
i want to check no.of hours like 34.30 00.30,
Regular expressions for no .of hours
Title: javascript - regex syntax error
Name: jeff
Date: 6/4/2008 12:20:48 PM
Comment:
hi.. using the test feature on this page and selecting the client side engine w/javascript results in a javascript syntax error in regular expression (line 417, char 9). the value being tested was 10/12/2003 12:43:09.
on another note, can year and day syntax in the expression be swapped to validate the format YYYY-MM-DD HH:mm:ss?
thanks so much for your work. :)
Title: Nevermind I apologize
Name: Nicole
Date: 6/21/2007 5:59:19 PM
Comment:
Nevermind, I apologize. It was a typing error that occured when I removed the date portion. Sorry! Thanks again.
Title: Validating 31/11/2000
Name: Nicole
Date: 6/21/2007 5:53:26 PM
Comment:
Could there be a minor bug in the regex that is allowing 31/11/2000 (or any year)? It seems like it is returning a valid match for this date, but I am going to do some more investigation to make sure I don't have a mis-copied character. Thanks for saving me the time on this!
Title: JavaScript Error
Name: Vipul Mehta
Date: 9/26/2006 1:30:54 AM
Comment:
While implementing the below given expression, it gives me JavaScript expression. I wanna validate my date time in dd/MM/yyyy hh:mm format. So in that case which part should I delete from this expression.
Plzzz help!!!
(?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})?$)
Title: Re: Syntax error
Name: Michael Ash
Date: 3/3/2005 10:24:44 AM
Comment:
Is your code using a .Net language. This version is using .Net's syntax that is not universal. If that is the case see http://blogs.regexadvice.com/mash/archive/2004/06/17/1269.aspx for another version.
If you are using .Net don't copy the regex from this page. Click on the test link for this regex and copy it from there. The Display pages include some line breaks that aren't part of the regex.
Title: Syntax error
Name: Deepills
Date: 3/3/2005 6:42:15 AM
Comment:
wonder why??I am getting a syntax error in regular expression when i use this in my code!!Any help????
Title: Re: 12/12/04 get Invalid Date
Name: Michael Ash
Date: 11/1/2004 12:00:17 PM
Comment:
As well you should.
Please read the description of what format is being validated. Year must be 4 digits between 1600-9999. 04 does not satify either of those conditions.
If you need another format see http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx
Title: 12/12/04 get Invalid Date
Name: ai4u
Date: 11/1/2004 4:27:34 AM
Comment:
Have tried your regular expresion from
(?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})?$)
but on checking 12/12/04 I get Invalid Date .
Also on some other dates I get Javascript Syntax error in regular expression .
Title: re: Sweedish datetime
Name: Michael Ash
Date: 6/16/2004 8:35:39 AM
Comment:
Jensen, please retry http://regexlib.com/REDetails.aspx?regexp_id=581 The parse error was caused because the website has turned on the ignorewhitespace property, which was false when the regex was orginally posted. I've changed to regex to explicitly look for spaces
If you wish to use another date separator beside the 3 provided simply adding it to the begining of 'sep' character class [/.-]
Title: Sweedish datetime
Name: Jensen Bredal
Date: 6/16/2004 2:32:12 AM
Comment:
Well i followed you link:
I tested the reg.ex for the datetime: 2003-09-23 11:32:45
And It looks like it causes an excpetion:
************************************************
Regular Expression Tester
System.ArgumentException: parsing "^(?ni:(?=\d)((?'year'((1[6-9])|([2-9]\d))\d\d)(?'sep'[/.-])(?'month'0?[1-9]|1[012])\2(?'day'((?((0?[1-9]|1[012])(:[0-5]\d){0,2}( [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2}))?)$" - Quantifier {x,y} following nothing. Parameter name: ^(?ni:(?=\d)((?'year'((1[6-9])|([2-9]\d))\d\d)(?'sep'[/.-])(?'month'0?[1-9]|1[012])\2(?'day'((?((0?[1-9]|1[012])(:[0-5]\d){0,2}( [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2}))?)$ at System.Text.RegularExpressions.RegexParser.ScanRegex() at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op) at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options) at System.Text.RegularExpressions.Regex.Match(String input, String pattern, RegexOptions options) at ASPAlliance.RegExp.Pages.
Title: re: Sweedish datetime
Name: Michael Ash
Date: 6/15/2004 7:58:13 AM
Comment:
Try http://regexlib.com/REDetails.aspx?regexp_id=581
Please refer to http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx for any other alternate date formats
Title: Sweedish datetime
Name: Jensen Bredal
Date: 6/15/2004 6:43:54 AM
Comment:
Ifno which one could i use independantly?
Again thanks
Title: Sweedish datetime
Name: Jensen Bredal
Date: 6/15/2004 6:30:31 AM
Comment:
Hello and thnaks for your great code.
Is there any way your regular expression can be modified to
match the sweedich Date and time?
It has the following format:yyyy-mm-dd tt:mm:ss.
Many thanks
Jensen Bredal
Title: Re: Has a problem with the 20th day
Name: Michael Ash
Date: 2/6/2004 10:04:59 AM
Comment:
Thanks for the catch. I've fixed it.
Title: Has a problem with the 20th day
Name: Troy
Date: 2/5/2004 10:17:35 PM
Comment:
20/06/2004 is not a match nor is anything with a day of the 20th regardless of month or year setting
Title: New Format
Name: Michael Ash
Date: 12/19/2003 4:06:44 PM
Comment:
This is the DD/MM/YYYY format of the regex I just posted for MM/DD/YYYY format
http://www.regexlib.com/REDetails.aspx?regexp_id=504
Please see the comments there for the general detail of why I added this pattern
This version was actually a little easier write than the MM/DD format.
When I posted my original date regex
http://www.regexlib.com/REDetails.aspx?regexp_id=113 I got several request to change the format from MM/DD/YYYY to DD/MM/YYYY. I had been using code to allow me to check either format. After sending out a few copies a of modified version of the regex I decide to post it, only to find someone had already modified the original and posted it. http://www.regexlib.com/REDetails.aspx?regexp_id=151
This version uses a new approve to validating dates and should evaluate faster.