当前位置:Gxlcms > PHP教程 > php里惯用正则表达式总结

php里惯用正则表达式总结

时间:2021-07-01 10:21:17 帮助过:4人阅读

php里常用正则表达式总结

1、必须由英文,数字组合而成的字符串:

 if(!preg_match("/^(([a-z]+[0-9]+)|([0-9]+[a-z]+))[a-z0-9]*$/i",$spend)){                 return $this->_ajaxMessage(1, '模板id必须由字母和数字组成', array());	             }

?2、由数字,英文字符与下划线:

  if(!preg_match("/^[a-zA-Z0-9_]*$/i",$spendCancel)){                return $this->_ajaxMessage(1, '您输入的消费撤销通知模板id不合法', array());	            }

?

人气教程排行