Home  >  Article  >  Backend Development  >  php正则表达式,允许有数字,字母,和标点

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

WBOY
WBOYOriginal
2016-06-23 13:44:181715browse

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


回复讨论(解决方案)

/^\S+$/
非空白字符就包含符号了

/^[0-9a-zA-Z_,]{6,16}$/

/^\S+$/
非空白字符就包含符号了


能给我个全的吗?我不会写正则,全是在网上找代码

/^[0-9a-zA-Z_,]{6,16}$/


这个不对

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

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