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

 

你可能感兴趣的:(php,正则,php)