Home >Backend Development >PHP Tutorial >php正则表达式,容许有数字,字母,和标点

php正则表达式,容许有数字,字母,和标点

WBOY
WBOYOriginal
2016-06-13 12:10:34976browse

php正则表达式,允许有数字,字母,和标点
php正则表达式,允许有数字,字母,和标点
,下面的是允许数字和字母。但是标点不知道怎么写
if(preg_match(" /^[0-9a-zA-Z_]{6,16}$/",$password)){  
 //通过
}else{
 //不能通过
}
------解决思路----------------------
/^[0-9a-zA-Z_,]{6,16}$/
------解决思路----------------------

if(preg_match(" /^\S{6,16}$/",$password)){  <br /> //通过<br />}else{<br /> //不能通过<br />}

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