jquery Regular: Phone, id, email simple check

Source: Internet
Author: User

if (! (/^1[3,5,6,7,8,9]\d{9}$/). Test (E.detail.value.data_phone)) {      Wx.showtoast ({        ' Please enter a valid 11-digit mobile number! ') ,      })     Else if (! (/(^\d{15}$) | (^\d{17} ([0-9]| X|X) ($)/. Test (E.detail.value.data_idcard))) {      Wx.showtoast (        {' ID number must be a 18-bit second-generation ID card! ') ,      })   } Else if (! (/^ ([a-za-z0-9_-]) [email protected] ([a-za-z0-9_-]) + (. [ A-za-z0-9_-]) (+$)/. Test (E.detail.value.data_email))) {         Wx.showtoast (        {' Please enter the correct email address ',      })   }
Explanation of the test function of JS regular expression

The return value of the method is a Boolean value that can match the result of hermetical expression in the string, if there is a match, return ture, if there is no match return false, this method is often used to judge the legality of user input data, such as verifying the legality of email

jquery Regular: Phone, id, email simple check

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.