PHP常用正则表达式
// 域名正则式 const URLRULE =‘/^http[s]?:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z_!~*\‘()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6})(:[0-9]{1,4})?((\/\?)|(\/[0-9a-zA-Z_!~\*\‘\(\)\.;\?:@&=\+\$,%#-\/]*)?)$/‘; //固定号码 const TELEPARSE = ‘/^[048]\d{2,3}-?\d{3,4}-?\d{3,4}(-\d{1,})?$/‘; //手机号码 const MOBILEPARSE = ‘/^(\+?86-?)?(18|17|15|13)[0-9]{9}$/‘; //电话号码 const PHOTOPARSE = ‘/(^(\+?86-?)?(18|17|15|14|13)[0-9]{9}$)|(^[048]\d{2,3}-?\d{3,4}-?\d{3,4}(-\d{1,})?$)/‘; //邮箱地址 const MAILPARSE = ‘/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i‘; //浮点数 const FLOAT = ‘/^\\d+(\\.\\d+)?$/‘; //数字 const INTEGER = ‘/^[0-9]*$/‘; //"2090009973,2089948681" const SPLIT_INTEGER = ‘/^(\d[,]?)*$/‘; //无特殊字符 const CHINESE = ‘/^[\x{4e00}-\x{9fa5} A-Za-z0-9\-_\*]+$/u‘; //只能是0或者1 const ZORE_OR_ONE = ‘/^[0|1]*$/‘; //连续出现两个{ const CONTINUOUS_BRACE = "/({[^{^}]+}\s*){2}/"; //三个{} const THREE_BRACE = "/(.*{.*}.+){4,}/";
本文出自 “梦朝思夕” 博客,请务必保留此出处http://qiangmzsx.blog.51cto.com/2052549/1597478
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。