JavaScript input form data Regular validation rules

Source: Internet
Author: User

1Emailnamereg:/^ (([a-za-z0-9]+\w* (\.\w+) | ( -\w+)) *[\.-]? [a-za-z0-9]+) | ([a-za-z0-9])) $/,//Match mailbox Name2Emailreg:/^ (([a-za-z0-9]+\w* (\.\w+) | ( -\w+)) *[\.-]? [a-za-z0-9]+) | ([a-za-z0-9])) \@[a-za-z0-9]+ ((\.| -) [a-za-z0-9]+] *\. [A-za-z0-9]+$/,//Match Mailbox3Mobilereg:/^1[3,4,5,7,8][0-9]{9}$/,//Match Phone number4Passwordreg:/^\s{1,20}$/,//match password matches all non-whitespace5Numberreg:/^[0-9]*$/,//Match Numbers6Vcodereg:/^[a-za-z0-9]*$/,//Matching graphics Verification code7Linkmanreg:/^ (\w|[ \u4e00-\u9fa5]|\s) *$/,//Match Contact Information8Uppercasereg:/[a-z]/G,9Compannamereg:/^ (\w|[ \U4E00-\U9FA5]) *$/,//match Chinese character digit letter underline
1 //string length, a Chinese record of 2 lengths2 functiongetcharlength (str) {3     varIlength = 0;4      for(vari = 0;i<str.length;i++){5         if(Str.charcodeat (i) >255){6Ilength + = 2;7}Else {8Ilength + = 1;9         }Ten     } One     returnilength; A}

JavaScript input form data Regular validation rules

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.