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

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

WBOY
WBOYOriginal
2016-06-13 12:09:20921browse

正则验证问题,6-16位字母或数字
正则验证问题,6-16位字母或数字
------解决思路----------------------
只能是 字母+数字 还是 字母 还是 数字 ?
------解决思路----------------------
/[0-9]/                   //数字
/[a-zA-Z]/              //字母
/[a-z0-9]/              //数字+字母
------解决思路----------------------
允许纯字母或数字串
/^[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