JS Common Regular Expression validation and description

Source: Internet
Author: User

Tag:rip   mic   highlight   length    ID     for    expression    log   turn   

    var verify = {/** * [determines whether the data is an integer] * @param {[number]} v [Digital] */Isinteger (v) { Return/(?: ^0 $)| (?: ^[^0\.)        \d*?$)/.test (v);            },/** * [determines if 6-bit verification code] * @param {[String]} v [Verification code] */Iscode:function (val) {        Return/^\d{6}$/.test (Val);            },/** * [bank card number is separated by four bits] * @param {[number]} v [Digital] */bankcodeformat:function (v) {            v = ' + V;            v = v.replace (/\s+/g, "). Replace (/(\d{4}|\*{4}|\*{3}\d{1}|\*{2}\d{2}|\*{1}\d{3})/g, ' $ '); Return v},/** * [only contains kanji] * @param {[String]} v [Kanji] */ischinese:function (Val)        {return/^[\u4e00-\u9fa5]{0,}$/.test (val);            },/** * [can contain only letters and numbers] * @param {[String]} v [Letters and numbers] */Isnotchinese:function (val) {        Return/^[a-za-z0-9]{4,40}$/.test (Val); },/** * [Determines whether theNumber] * @param {[String]} v [number] */isnumber:function (v) {return!isnan (v) &&        V.indexof ('. '); },/** * [True is overflow, false is non-overflow] * @param {[String]} v [number] */isoverflow:function (v            , Len) {var L = v.length;            Len >> 0;        return l > Len; },/** * ID number and binding with "*" ID number verification **/isid:function (val) {val = Val.replace (/\s+/g, '            ); Return/(^\d{17} ([0-9]| X)) | (^[1-9]{1}[*]{16}[0-9|        X]) $/.test (Val); },/** * Binds the bank card number and the user entered the bank card * @param string as well as the number **/Isbank:function (val) {val =            Val.replace (/\s+/g, "); Return/^ (\d{16}|\d{18}|\d{19}) |        (^[*]{12,15}[0-9]{4}) $/.test (Val); },/** * brings out the phone number and user entered the phone number * @param string as well as the number **/Istel:function (val) {return /(^1[34578]\d{9}) $|     (^[1]{1}[0-9]{2}[*]{4}[0-9]{4}) $/.test (Val);   },/* Determine if the browser is open */is_weixn:function () {var ua = navigator.userAgent.toLowerCase ();            if (Ua.match (/micromessenger/i) = = "Micromessenger") {return true;            } else {return false; }        }    }

  

JS Common Regular Expression validation and description

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.