坚持不懈,努力不断

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 

正则表达式
时间:美国()

^(((0[1-9]|1[012])/(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])/(29|30)|(0[13578]|1[02])/31)/[2-9]\d{3}|02/29/(([2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$

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


---------------------------------------------------------------------------------------------------------------------------------
整数:
Title: Pattern Title [Details] [Test]
Expression: ^\d+$

Description: This is derived from Steven Smith's Integer expression (http://www.regexlib.com/REDetails.aspx?regexp_id=51). The only difference is that this does not accept blanks. Written by Jason N. Gaylord.
Matches: 2|||50|||0
Non-Matches: -15|||1.2

----------------------------------------------------------------------------------------------------------------------------------------------------------
小数:
Title: Pattern Title [Details] [Test]
Expression: (^\d*\.?\d*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$)

Description: This matches all positive decimal values. There was one here already which claimed to but would fail on value 0.00 which is positive AFAIK...
Matches: 0.00|||1.23|||4.5655
Non-Matches: -1.03|||-0.01|||-0.00

Author: Derek Noonan


Title: Pattern Title [Details] [Test]
Expression: ^[0-9]*(\.)?[0-9]+$

Description: it will check for the +ve decimal numbers
Matches: 1|||123|||132.132
Non-Matches: 1.2.2|||-123

Author: himraj love

posted on 2007-05-07 11:37  大傻  阅读(221)  评论(0编辑  收藏  举报