Summary of the methods for verifying mobile phone numbers and email addresses using javascript. Although there are many such examples on the Internet, it is always the best to write the code by yourself. The following two examples are prepared by yourself, share with you.
// Function is_mobile (value) {var pattern =/^ 1 [358] [0123456789] \ d {8 }$/; if (! Pattern. test (value) {return false;} return true ;}
// Verify email correctness using javascript function is_email (value) {var pattern =/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $/; if (! Pattern. test (value) {return false;} return true ;}
Articles you may be interested in
- Js verification mobile phone number function (from Ding ding map)
- Use JavaScript to verify the regular expression of the mobile phone number
- Javascript, php Regular Expression verification for mixed numbers and letters (6-15 digits)
- Php uses the filter function to verify the mailbox, url, and IP address
- Php mobile phone number Retrieval
- Common Javascript Verification Code collections such as js verification URLs
- Examples of using Google map for javascript development roadmap
- How to verify the validity of date and time using javascript