标签:
---恢复内容开始---
function checkUrl(url) { var re = /((http:\/\/|https:\/\/|ftps:\/\/)*([\w\u4e00-\u9fa5\-]+\.)+[\w\u4e00-\u9fa5\-]+(\/[\w\u4e00-\u9fa5\-\.\/?\@\%\!\&=\+\~\:\#\;\,]*)?)/ig; return re.test(url); } function checkPhone(num){ return checkMobile(num) || checkTelephone(num); } function checkMobile(num){ var re = /^1[3,4,5,7,8]\d{9}$/; return re.test(num); } function checkTelephone(num){ var phoneReg = /(^\+86\.\d{3,5}\d{6,8}$)|(^\d{3}((\d-)|(-\d)|\d|-)\d{3}(\d|-|)\d{3}$)/; return phoneReg.test(num); } function checkEmail(email){ var re = /^[&~#$*%\u4e00-\u9fa5_0-9a-z\-\.\/\\]+@([\u4e00-\u9fa5-a-z0-9]+\.){1,5}[\u4e00-\u9fa5a-z]+$/i; return re.test(email); } function checkDomain(domain){ var re = /^([\u4e00-\u9fa5-a-z0-9]+\.){1,5}[\u4e00-\u9fa5a-z]+$/i; return re.test(domain); } function checkNumber(number){ var re = /^[1-9]\d*$/; return number == 0 || re.test(number); } function checkDate(dateStr){ var re = /^\d{4}(-)\d{2}(-)\d{2}$/; return re.test(dateStr); } function checkDateTime(dateTimestr){ var re = /^\d{4}(-)\d{2}(-)\d{2}( )\d{2}:\d{2}:\d{2}$/; return re.test(dateTimestr); } function checkMoney(money){ var re = /^(0|[1-9]\d*)(\.\d{1,2})?$/; return re.test(money); }
---恢复内容结束---
标签:
原文地址:http://www.cnblogs.com/rubekid/p/5495432.html