Home > Backend Development > PHP Tutorial > 正则验证问题,6-16位字母或数字

正则验证问题,6-16位字母或数字

WBOY
Release: 2016-06-23 13:46:02
Original
1627 people have browsed it

正则验证问题,6-16位字母或数字


回复讨论(解决方案)

只能是 字母+数字 还是 字母 还是 数字 ?

/[0-9]/                   //数字
/[a-zA-Z]/              //字母
/[a-z0-9]/              //数字+字母

/[a-z0-9]{6,16}/ 

允许纯字母或数字串
/^[a-z0-9]{6,16}$/

必须同时含有字母和数字
/^(?=.{6,16})(?=.*[a-z])(?=.*[0-9])[0-9a-z]*$/

只能是 字母+数字 还是 字母 还是 数字 ?


字母加数字

/^[a-z0-9]{6,16}$/i

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