JS Common mobile phone number ZIP code number regular verification

Source: Internet
Author: User
Tags zip

JS Common mobile phone number ZIP code number regular verification

*/

Phone number Verification
function Istelephone (str)
{
RegExp =/^[0-9]+ (-[0-9]+) {1,2}$/;
return Regexp.test (str);
}


ZIP Code Verification
function Ispostcode (str)
{
RegExp =/^[0-9]{6,6}$/;
return Regexp.test (str);
}

Mobile Verification

function IsMobile (str)
{
RegExp =/^[0-9]{11,11}$/;
return Regexp.test (str);
}

Digital verification

function Isidnumber (str)
{
REGEXP1 =/^[0-9]{17,17}[0-9xx]$/;
REGEXP2 =/^[0-9]{15,15}$/;
Return (Regexp1.test (str) | | regexp2.test (str);
}


Function Isnum (argvalue)
{
 var flag1=false;
 var Comps Tutorial tr= " -1234567890";
 var Length2=argvalue.length;
 for (var iindex=0;iindex<length2;iindex++)
 {
  var temp1=compstr.indexof ( Argvalue.charat (Iindex));
  if (temp1==-1)
  {
   flag1=false;
   break; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP
  }
  else
  {
    flag1=true;
  }
 }
 return Flag1;
}
Remove space
Function trim (info)
{
 return info.replace (^s*) | ( s*$)/g, "");
}

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.