黑马程序员技术交流社区

标题: 很全的正则表达式分享 [打印本页]

作者: ノtrack    时间: 2014-4-25 19:25
标题: 很全的正则表达式分享
isLoginName = ^[A-Za-z][A-Za-z0-9\\_\\@\\.]+$
isFaxNumber = ^[0-9\\-]+$
isNumOrWord = ^[A-Za-z0-9]+$
isJiXing = ^[ -~]+$
isPassWord = ^[A-Za-z0-9\\_\\@]+$
isNumber = ^[0-9]+$
isNotEmpty = .+
isEmptyAble = .*
isNotSpace = ^\\S+$
isPositiveNumber = ^\\d+\\.?\\d*$
isPositiveNumber_12_2 = ^\\d{1,10}([url=]\\.\\d{0,2}){0,1}$[/url]
isPositiveNumber_15_2 = ^\\d{1,13}([url=]\\.\\d{0,2}){0,1}$[/url]
isPositiveNumber_10_2 = ^\\d{1,8}([url=]\\.\\d{0,2}){0,1}$[/url]
isPositiveNumber_10_3 = ^\\d{1,7}([url=]\\.\\d{0,3}){0,1}$[/url]
isPositiveNumber_5_2 = ^\\d{1,3}([url=]\\.\\d{0,2}){0,1}$[/url]
isPositiveNumber_5_4 = ^\\d{1}([url=]\\.\\d{0,4}){0,1}$[/url]
isPositiveInteger = ^\\d*[1-9]+\\d*$
isPositiveNumber_15_3 = ^\\d{1,12}([url=]\\.\\d{0,3}){0,1}$[/url]
isMobile = ^13\\d{9}$
isZipCode = ^\\d{6}$
isBpNumber = ^\\d{5,8}[-]?\\d{3,7}$
isPhoneNumber = ^\\d{6,8}$
isPhoneorNumber = ^[0-9\\-]+$
isFileName = ^[a-zA-Z0-9\\.-_]+$
isWord = ^\\w+$
isPidNumber = ^[1-9]\\d{14,17}[xX]?$
isValidDate = ^((1[6-9]|[2-9]\\d)?\\d{2})-(((0[13578]|1[02])-31)|((0[1,3-9]|1[0-2])-(29|30)))$|^(((1[6-9]|[2-9]\\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))-(02-29)$|^((1[6-9]|[2-9]\\d)?\\d{2})-((0[1-9])|(1[0-2]))-(0[1-9]|1\\d|2[0-8])$
isValidDateWithTime = ^((1[6-9]|[2-9]\\d)?\\d{2})-(((0[13578]|1[02])-31)|((0[1,3-9]|1[0-2])-(29|30)))([url=]\\s((\\b0\\d\\b)|(1\\d)|(2[0-3]))\:((\\b0\\d\\b)|([1-5]\\d))){0,1}$|^(((1[6-9]|[2-9]\\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))-(02-29)(\\s((\\b0\\d\\b)|(1\\d)|(2[0-3]))\:((\\b0\\d\\b)|([1-5]\\d))){0,1}$|^((1[6-9]|[2-9]\\d)?\\d{2})-((0[1-9])|(1[0-2]))-(0[1-9]|1\\d|2[0-8])(\\s((\\b0\\d\\b)|(1\\d)|(2[0-3]))\:((\\b0\\d\\b)|([1-5]\\d))){0,1}$[/url]
isEmail = ^\\w+((-\\w+)|([url=]\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$[/url]
isChineseName = ^[\u4E00-\u9FA5]{2,}$
isChinese = ^[\u4E00-\u9FA5]+$
isNotChinese = ^[^\u4E00-\u9FA5]+$
isURL = ^(http\://){0,1}.+\\..+\\..+$
isValidDateText = ^[0-9]{4}[-\\./][0-1]{1}[0-9]{1}[-\\./][0-9]{1,2}$
isDbString = [^'%<>]+
// isNumber = [01]
isSpecNumber = ^\\-?\\d*[0-9]+\\d*$
isPosiInteger = ^\\d*[0-9]+\\d*$
isBillDt = ^((1[6-9]|[2-9]\\d)?\\d{2})(0[1-9]|10|11|12)$
isNot0 = ^\\[1-9]+$
isNumber2 = ^\\d{2}$
isNumber3 = ^\\d{3}$
isNumber3_4=^\\d{3}|\\d{4}$
isNumber4 = ^\\d{4}$
isNumber1_4 = ^\\d{1,4}$
isNumber5 = ^\\d{5}$
isNumber6 = ^\\d{6}$
isNumber7 = ^\\d{7}$
isNumber8 = ^\\d{8}$
isNumber9 = ^\\d{9}$
isNumber10 = ^\\d{10}$
isNumber1_10 = ^\\d{1,10}$
isNumber11 = ^\\d{11}$
isNumber13 = ^\\d{13}$
isNumber14 = ^\\d{14}$
isNumber15 = ^\\d{15}$
isNumber16 = ^\\d{16}$
isNumber18 = ^\\d{18}$
isNumber19 = ^\\d{19}$
isNumber20 = ^\\d{20}$
isEnglish=^[A-Za-z]+$
isPositiveNumber11 = ^\\d{11}$
isPassWord6 = ^[A-Za-z0-9\\_\\@]{6}$
isPassWord16 = ^[A-Za-z0-9\\_\\@]{16}$
isPassWord20 = ^[A-Za-z0-9$]{6,20}$
isRate = ^(([url=]\\d{1,2}\\.\\d{1})|(\\d{1,2})|(100)|(100\\.0))$[/url]
isRate2 = ^(([url=]\\d{1,2}\\.\\d{1,2})|(\\d{1,2})|(100)|(100\\.0)|(100\\.00))$[/url]
isMon = ^(([url=]\\d{1,6}\\.\\d{1,2})|(\\d{1,6}))$[/url]
isValidDateFormat = ([url=]\\d{4}\\-((0[1-9])|(1[012]))\\-((0[1-9])|([1-2][0-9])|(3[01[/url]])))
isMon14 = ^(([url=]\\d{1,12}\\.\\d{1,2})|(\\d{1,12}))$[/url]
isMon15 = ^(([url=]\\d{1,13}\\.\\d{1,2})|(\\d{1,13}))$[/url]
isMon10 = ^(([url=]\\d{1,8}\\.\\d{1,2})|(\\d{1,8}))$[/url]
isMon8 = ^(([url=]\\d{1,6}\\.\\d{1,2})|(\\d{1,6}))$[/url]
isMon13 = ^(([url=]\\d{1,11}\\.\\d{1,2})|(\\d{1,11}))$[/url]
isMon11 = ^\\d{1,11}$
isHoure = ^(([0-1]{1}[0-9]{1})|([2]{1}[0-3]{1}))$
isMinitorORSecond = ^([0-5]{1}[0-9]{1})$
isValidDateNum = ^(undefinedundefined)|((1[6-9]|[2-9]\\d)?\\d{2})(((0[13578]|1[02])31)|((0[1,3-9]|1[0-2])(29|30)))$|^(((1[6-9]|[2-9]\\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))(0229)$|^((1[6-9]|[2-9]\\d)?\\d{2})((0[1-9])|(1[0-2]))(0[1-9]|1\\d|2[0-8])$
isMoney = ^(([1-9][0-9]{0,7})|[0-9])(([url=]\\.(\\d{1,2}))|)$[/url]
isMoney2=^\\d+\\.\\d{2}$
isSepcialEmail=^\\w+((-\\w+)|([url=]\\.\\w+))*\\@pingan\\.com\\.cn$[/url]
//isSepcialEmail=^[\\w^\\@]+((-[\\w^\\@]+)|([url=]\\.[\\w^\\@]+))*\\@pingan\\.com\\.cn$[/url]
isMobileOrPhone=(^(13|15|18)\\d{9}$)|(^[0][1-9]{1}\\d{1}\\-\\d{7,8}$)|(^[0][1-9]{1}\\d{2}\\-\\d{7,8}$)
isMobile2=^(13|15|18)\\d{9}$


作者: 轻语。    时间: 2014-4-25 19:47
那几个穿插在里面的表情  真心亮了。
      这些让我想起  所谓万能密码。
作者: ò壞尛孩    时间: 2014-4-25 20:00
正则是破解密码的神器!
作者: 你为谁归来    时间: 2014-4-25 22:39
话说我滑动鼠标滚轮的时候眼睛一片模糊啊!!!
作者: Sunday    时间: 2014-4-26 00:17
太好了,学习了
作者: ノtrack    时间: 2014-5-7 09:51
:lol                                




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2