_ajaxMessage(1, '模板id必须由字母和数字组成', a"/> _ajaxMessage(1, '模板id必须由字母和数字组成', a">

Home  >  Article  >  Backend Development  >  php里惯用正则表达式总结

php里惯用正则表达式总结

WBOY
WBOYOriginal
2016-06-13 12:08:00883browse

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());	            }

?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn