Home > Web Front-end > JS Tutorial > How to write the login and registration front-end verification input format

How to write the login and registration front-end verification input format

一个新手
Release: 2017-09-22 10:10:36
Original
2093 people have browsed it

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

1. Verify mobile phone number

var reg= /^1[3-578]\d{9}$/
Copy after login

2. Verify name

 var reg=/^[\u4e00-\u9fa5a-zA-Z0-9]{2,10}$/
Copy after login

3. Verify password

var reg = /^(?!\D+$)(?![^a-zA-Z]+$)\S{8,}$/;//密码必须是数字 字母 特殊字符 不支持空格  最少8位
Copy after login

4. Verify verification code

var reg = /^[a-zA-Z0-9]{4}$///只能是4位的字母和数字
Copy after login

These four should be the most commonly used verifications

reg.test(验证的内容);
Copy after login

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!

Related labels:
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