namespaceYongfa365.validator {usingSystem;usingSystem.Text.RegularExpressions;/// ///RegExp soruce:http://regexlib.com/DisplayPatterns.aspx ///Author: Liuyongfa yongfa365http://www.yongfa365.com/[email protected]///Intro: Verify URL, IP, email, phone, phone, digital, English, date, ID, postcode ,///in principle is the Chinese general, because various
Detailed description of JavaScript ID card number validation and instance code, and detailed description of javascript
Recently, you need to verify the validity of your ID card. real-name verification is not expected. However, the original verification rules are too simple,
Try testing the following form with valid and invalid email addresses.
Code uses javascript to match the users input with a regular expression.
Function Code:
Copy codeThe Code is as follows: function validate (form_id, email ){
Var reg =/^ ([A-Za-z0-9 _ \-\.]) + \ @ ([A-Za-z0-9 _ \-\.]) + \. ([A-Za-z] {2, 4}) $ /;
Var address = document. forms [form_id]. element
Try testing the following form with valid and invalid email addresses. The
Code uses JavaScript to match the users input with a regular expression.
Function code:
Copy Code code as follows:
function Validate (Form_id,email) {
var reg =/^ ([a-za-z0-9_\-\.]) +\@ ([a-za-z0-9_\-\.]) +\. ([a-za-z]{2,4}) $/;
var address = Document.forms[form_id].ele
A period of time ago wrote a JS data validation, JS email verification, JS URL verification, JS length verification, JS digital verification, such as pop-up dialog box form but, now not very popular kind of very unfriendly way, so rewrite a, packaged better, more friendly layer form share to everyone, If you use a bug, please give me a message perfect, thank you.
JS Code
Copy Code code as follows:
/** Mobile Phone number format * Only allow numbers starting with 13, 15, 18 * For example: 13012345678, 15929224344, 18201234676*/varRegmobile =/^1[3,5,8]\d{9}$/;/** Fixed telephone number format * Because the fixed phone format is more complex, the situation is more, mainly verify the following types of * such as: 010-12345678, 0912-1234567, (010)-12345678, (0912) 1234567, (010) 12345678, (0912)-1234567, 01012345678, 09121234567*/varRegphone =/^ (^0\d{2}-?\d{8}$) | (^0\d{3}-?\d{7}$) | (^0\d2-?
This article mainly introduces the jquery plug-in validation authentication ID number, passport, telephone number, email very simple and practical, the need for small partners can refer to.
First recommend a bootstrap jquery validation plugin: http://thrilleratplay.github.io/jquery-
JavaScript can be used to validate these input data in an HTML form before the data is sent to the server.
The typical form data that is validated by JavaScript is:
• Has the user filled out the required items in the form?• Is the email address that the user entered legal?• Has the user entered a valid date?• Does the user enter text in the Data field (numeric
email address. When your user type is "[email protected]", MailCheck think "[email protected]".Online preview9.formance.jsA jquery library for formatting and validating form fields, based on the striped jquery.payment library. It supports various fields such as credit card CVC, credit card expiry, credit card number, email
This article describes how to rewrite an asynchronous validation form to a synchronous form in javascript. For more information, see
Disadvantages of synchronous form verification
When responding to the error message, you need to reload the entire page (although there is a cache, the client still needs to compare whether each file is updated through the http protocol to keep the file up-to-date)After the s
1. Lightweight JavaScript Form validationReferencing files in your app validator.min.jsInstance: for= "Email" > Email verification DescriptionNew Validator (formName, option, callback)FormNameformNameis the value in the id tag name , as in the aboveexample_formOption
namenamethe corresponding value in input
JavaScript Validation form instance
If you are creating a responsive site that contains some input forms, you should verify user input data. If you have to verify the name, last name, Email, username, age, compression code, and other fields of a registry ticket, you do not need to send unnecessary responses to your server. Next you will learn how to use
Here are some of the more commonly used regular expressions I've collected, because it's usually possible to use more of the form validation. Special sends out, lets each friend use together. Oh.
Matching regular expressions for Chinese characters: [U4E00-U9FA5]Commentary: Matching Chinese is really a headache, with this expression will be easy to do
Match Double-byte characters (including Chinese characters): [^x00-xff]Commentary: can be used to co
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.