Home > Article > Web Front-end > How to write the login and registration front-end verification input format
When logging in and registering, sometimes the front-end needs to verify the legality of the content input format. Here are some simple and commonly used verifications
var reg= /^1[3-578]\d{9}$/
var reg=/^[\u4e00-\u9fa5a-zA-Z0-9]{2,10}$/
var reg = /^(?!\D+$)(?![^a-zA-Z]+$)\S{8,}$/;//密码必须是数字 字母 特殊字符 不支持空格 最少8位
var reg = /^[a-zA-Z0-9]{4}$///只能是4位的字母和数字
These four should be the most commonly used verifications
reg.test(验证的内容);
The above is the detailed content of How to write the login and registration front-end verification input format. For more information, please follow other related articles on the PHP Chinese website!