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

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

WBOY
Release: 2016-06-23 13:44:18
Original
1788 people have browsed it

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{ //不能通过}
Copy after login

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template