CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  JavaScript

求英文日期正则表达式怎么写?

楼主philipsslg(刮开中大奖(█))2006-03-16 02:13:34 在 Web 开发 / JavaScript 提问

如     01/21/2004       以   月/日/年   的顺序 问题点数:100、回复次数:15Top

1 楼philipsslg(刮开中大奖(█))回复于 2006-03-16 03:18:35 得分 0

up   一下Top

2 楼s1ihome(My hometown is a beautiful village)回复于 2006-03-16 08:02:50 得分 0

^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[2][0]\d{2})$|^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[2][0]\d{2}\s([0-1]\d|[2][0-3])\:[0-5]\d\:[0-5]\d)$    
   
  Matches:   12/01/2002|||12/01/2002   12:32:10    
  Non-Matches:   32/12/2002|||12/13/2001|||12/02/06    
  Top

3 楼s1ihome(My hometown is a beautiful village)回复于 2006-03-16 08:11:20 得分 0

楼主的使用这个  
   
  ^([0]\d|[1][0-2])\/(([0-2]\d|[3][0-1])\/[2][0]\d{2})$  
   
  就是年限制在20XX年了Top

4 楼mingxuan3000(铭轩)回复于 2006-03-16 08:13:45 得分 0

markTop

5 楼manyou(他山之石【养万头猪,行万里路】)回复于 2006-03-16 08:28:50 得分 0

function   strDateTime(str)    
  {    
  var   r   =   str.match(/^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[2][0]\d{2})$/);    
  if(r==null)   alert(格式错误);    
  var   d=   new   Date(r[1],   r[3]-1,   r[4]);    
  return   (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);    
  }Top

6 楼philipsslg(刮开中大奖(█))回复于 2006-03-16 10:17:44 得分 0

s1ihome(我的家乡)   有没有改进一点的?Top

7 楼philipsslg(刮开中大奖(█))回复于 2006-03-16 10:35:07 得分 0

好像都有问题的,特定的日子就不行  
  Top

8 楼meizz(梅花雪)回复于 2006-03-16 10:45:38 得分 0

String.prototype.isDate   =   function()  
  {  
        var   r   =   this.match(/^(\d{1,2})(-|\/)(\d{1,2})\2(\d{1,4})$/);    
        if(r==null)return   false;   var   d   =   new   Date(r[4],   r[1]-1,   r[3]);    
        return(d.getFullYear()==r[4]&&(d.getMonth()+1)==r[1]&&d.getDate()==r[3]);  
  }  
  alert("01/21/2006".isDate());     //针对   月/日/年   格式的判断  
  alert("02/29/2006".isDate());Top

9 楼philipsslg(刮开中大奖(█))回复于 2006-03-17 01:31:56 得分 0

这个就更加错了,哪有2006年2月,哪有29号Top

10 楼philipsslg(刮开中大奖(█))回复于 2006-03-17 01:40:34 得分 0

说错2006年2月,哪有29号Top

11 楼meizz(梅花雪)回复于 2006-03-17 09:10:25 得分 0

就是因为没有   2006-2-29   所以这个函数的返回值是   false,楼主你到底想要什么?不就是判断日期字符串是否为正确的日期格式吗?Top

12 楼philipsslg(刮开中大奖(█))回复于 2006-03-18 03:34:44 得分 0

我只是要一个正规表达就能判断,不是像你写这么一个函数,我希望你后面几步不要,让正规表达式复杂一点。  
  Top

13 楼time_is_life(今夜太冷:http://timeislife.blog.sohu.com)回复于 2006-03-22 14:33:51 得分 0

Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^\d{1,2}\/\d{1,2}\/\d{4}$      
       
  Description:   This   regular   expressions   matches   dates   of   the   form   XX/XX/YYYY   where   XX   can   be   1   or   2   digits   long   and   YYYY   is   always   4   digits   long.    
  Matches:   4/1/2001|||12/12/2001|||55/5/3434    
  Non-Matches:   1/1/01|||12   Jan   01|||1-1-2001    
       
  Author:   Steven   Smith   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[2][0]\d{2})$|^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[2][0]\d{2}\s([0-1]\d|[2][0-3])\:[0-5]\d\:[0-5]\d)$      
       
  Description:   Correct   French   DateTime(DD/MM/YYYY   OR   DD/MM/YYYY   HH:MM:SS)    
  Matches:   12/01/2002|||12/01/2002   12:32:10    
  Non-Matches:   32/12/2002|||12/13/2001|||12/02/06    
       
  Author:   Samir   AZZA   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  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:   David   Darling   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^[\w-\.]+@([\w-]+\.)+[\w-]{2,3}$      
       
  Description:   For   Date   format   MM-JJ-YYYY   validation      
  Matches:   umtsfr@free.fr|||123@dz.com|||regexlib@regexlib.fr    
  Non-Matches:   umtsfr@free|||umtsfrfree.fr|||@free.fr    
       
  Author:   Hakim   SALHI   Rating:   Not   yet   rated.      
     
  Title:   DateTime   M/d/y   hh:mm:ss   [Details]   [Test]      
  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:   Michael   Ash   Rating:        
     
  Title:   Time   [Details]   [Test]      
  Expression:   ^((0?[1-9]|1[012])(:[0-5]\d){0,2}(\   [AP]M))$|^([01]\d|2[0-3])      
       
  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:   Michael   Ash   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   (((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])(\d{4}))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])(\d{4}))|((29)(\.|-|\/)(02)([/])([02468][048]00))|((29)([/])(02)([/])([13579][26]00))|((29)([/])(02)([/])([0-9][0-9][0][48]))|((29)([/])(02)([/])([0-9][0-9][2468][048]))|((29)([/])(02)([/])([0-9][0-9][13579][26])))      
       
  Description:   Date   in   DD/MM/YYYY   format.   Fecha   en   formato   DD/MM/AAAA.    
  Matches:   28/12/2003|||28/02/2003|||29/02/2000    
  Non-Matches:   28-02-2003|||30/02/2003|||28.02.2003    
       
  Author:   Mathews   Inga   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  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:   Sung   Lee   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((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])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((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(((0?[1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$      
       
  Description:   Matches   ANSI   SQL   date   format   YYYY-mm-dd   hh:mi:ss   am/pm.   You   can   use   /   -   or   space   for   date   delimiters,   so   2004-12-31   works   just   as   well   as   2004/12/31.   Checks   leap   year   from   1901   to   2099.    
  Matches:   2004-2-29|||2004-02-29   10:29:39   pm|||2004/12/31    
  Non-Matches:   2003-2-29|||2003-13-02|||2003-2-2   10:72:30   am    
       
  Author:   Sung   Lee   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  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:   Michael   Gaertner   Rating:   Not   yet   rated.      
   
  Top

14 楼time_is_life(今夜太冷:http://timeislife.blog.sohu.com)回复于 2006-03-22 14:34:11 得分 100

Title:   Pattern   Title   [Details]   [Test]      
  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:   Ian   Wallace   Rating:   Not   yet   rated.      
     
  Title:   MMM   dd,   yyyy   Date   [Details]   [Test]      
  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:   Michael   Ash   Rating:        
     
  Title:   dd   MMM   yyyy   Date   [Details]   [Test]      
  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:   Michael   Ash   Rating:        
     
  Title:   Months   [Details]   [Test]      
  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:   Michael   Ash   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  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:   Manpreet   Grewal   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  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.   Please   see   comments   below.   This   regex   will   validate   a   date,   time   or   a   datetime.   It   will   also   capture   the   date   fields   and   the   time.   Dates   are   in   the   MM/DD/YYYY   format   and   validated   for   months,   number   of   days   in   a   month   and   leap   years   (2/29)   Month   and   day   field   less   than   10   may   have   a   leading   0.   Years   are   4   digits.   Range   1600-9999   Date   field   can   be   separted   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.   Datetime   is   the   above   date   and   time   formats   separated   by   a   space,   with   the   date   first   (MM/DD/YYYY   HH:mm:SS)   !IMPORTANT   NOTE:   your   regex   engine   must   support   lookaheads   and   named   groups   to   use   this   expression   Also   this   version   allow   for   capture   of   the   date   parts   which   you   can   then   use   in   your   code   month   =   \1   sep   =   \2   day   =   \3   year   =   \4   time   =   \5    
  Matches:   1/31/2002   10   AM|||2/29/2004|||4:15:04   PM    
  Non-Matches:   2/29/2003|||12/32/2003|||4:00    
       
  Author:   Michael   Ash   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  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:   Michael   Ash   Rating:        
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\,*\s\s*\d{4}$|^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\,*\s\d{4}$|^(January|February|March|April|May|June|July|August|September|October|November|December)\,*\s\d{4}$|^(january|february|march|april|may|june|july|august|september|october|november|december)\,*\s\d{4}$      
       
  Description:   Best   Use   validation   to   accept   a   valid   "MonthName(,)   Year".   It   can   validate   an   entry   with   or   without   comma   (,).      
  Matches:   January   2004|||Jan,   2004|||january   2003    
  Non-Matches:   Janu   2004|||jAn,   2004|||January,2003    
       
  Author:   Elmer   Cadelina   Rating:   Not   yet   rated.      
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^([0-9]{2})(00[1-9]|0[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-6])$      
       
  Description:   Matches   a   Julian   date   in   the   format   YYDDD.   Two   digit   year   followed   by   a   number   from   1   -   366   indicating   the   day   of   the   year.    
  Matches:   99366|||00001    
  Non-Matches:   74000|||04367    
       
  Author:   Brian   James   Rating:   Not   yet   rated.      
     
  Title:   Pattern   Title   [Details]   [Test]      
  Expression:   ^((31(?!   (FEB|APR|JUN|SEP|NOV)))|((30|29)(?!   FEB))|(29(?=   FEB   (((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|FEB|MAR|MAY|APR|JUL|JUN|AUG|OCT|SEP|NOV|DEC)   ((1[6-9]|[2-9]\d)\d{2})$      
       
  Description:   Validates   date   format   by   DD   MMM   YYYY.   Validates   days   for   each   month   also.   Ensures   that   month   is   uppercase.    
  Matches:   09   MAY   1981|||28   JAN   2004|||8   JUL   2006    
  Non-Matches:   29   FEB   2003|||28   Oct   2000|||9   APR   03    
     
  Top

15 楼time_is_life(今夜太冷:http://timeislife.blog.sohu.com)回复于 2006-03-22 14:34:22 得分 0

这下大家满意了吧Top

相关问题

  • 求助!谁会写日期正则表达式?
  • 想得个英文日期得的正则表达式就这么难嘛??
  • 请问这样的日期正则表达式怎么写:mm-dd-yy
  • (在线)像类似2005-02-10日期格式的正则表达式怎么写?
  • 日期的正则表达式
  • 日期正则表达式问题,急!!
  • 【正则表达式验证日期】
  • 求日期正则表达式一个!!
  • 20分求日期正则表达式
  • 求一日期正则表达式

关键词

  • pm
  • date
  • matched
  • x20
  • ruary
  • non
  • jan
  • yyyy
  • rating
  • ember

得分解答快速导航

  • 帖主:philipsslg
  • time_is_life

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo