随笔分类 -  正则表达式

摘要:function isIP(str) { var IP = '(25[0-5]|2[0-4]\\d|1\\d\\d|\\d\\d|\\d)'; var IPdot = IP + '\\.'; var isIPaddress = new RegExp('^' + IPdot + IPdot + IPdot + IP + '$'); return (isI... 阅读全文
posted @ 2016-12-27 14:02 wuln 阅读(149) 评论(0) 推荐(0)
摘要:function isEmail(s) { var reg = /^([a-zA-Z0-9\_\-\.])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,10}){1,9})$/; if (reg.test(s) === false) { return false; } return true; } 阅读全文
posted @ 2016-12-27 13:54 wuln 阅读(169) 评论(0) 推荐(0)
摘要:function isURL(str_url) { var strRegex = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP ... 阅读全文
posted @ 2016-12-27 13:51 wuln 阅读(162) 评论(0) 推荐(0)
摘要:function isPhoneNumber(s) { var reg = /^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)){1,12})+$/; if (reg.test(s) === false) { return false; } return true; } 阅读全文
posted @ 2016-12-27 13:36 wuln 阅读(118) 评论(0) 推荐(0)
摘要://身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X 阅读全文
posted @ 2016-12-27 11:23 wuln 阅读(127) 评论(0) 推荐(0)