How jquery uses regular expressions to verify the phone number, ID number, Chinese name _ Regular expression

Source: Internet
Author: User

Digital Judgment Method: isNaN () function

The test () method determines whether the string matches the contents of the regular expression, and returns a Boolean value (True/false)

Verify that the Chinese name 
function ischinaname (name) 
{var pattern =/^[\u4e00-\u9fa5]{1,6}$/; 
return pattern.test (name); 
//Verify the mobile number 
function Isphoneno (phone) { 
var pattern =/^1[34578]\d{9}$/; 
return pattern.test (phone); 
//Verify ID 
function Iscardno (card) { 
var pattern =/(^\d{15}$) | ( ^\d{18}$) | (^\d{17} (\d| X|X) $)/; 

The above is a small set of jquery to introduce how to use regular expressions to verify the mobile phone number, ID number, Chinese name of the relevant knowledge, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. I also thank you for your support for the cloud-dwelling community website.

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.