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

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

WBOY
WBOYOriginal
2016-06-23 13:46:021565browse

正则验证问题,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

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