当前位置: 代码迷 >> PHP >> php里惯用正则表达式总结
  详细解决方案

php里惯用正则表达式总结

热度:100   发布时间:2016-04-28 18:25:14.0
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());	            }

?