zoukankan      html  css  js  c++  java
  • 前端验证

    var myCheck = {
    regPhone: /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])d{8}$/,
    regTel: /d{3}-d{8}|d{4}-d{7}/,
    regID: /^d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$/,
    regChinese: /[u4e00-u9fa5]/,
    regTelCom: /[1-9]d{5}(?!d)/,
    regEmail: /^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/,
    regPositiveFloat2: /^[0-9]+(.[0-9]{2})?$/,
    regPositiveInt: /^[1-9]d*$/,
    regNegtiveInt: /^-[1-9]d*$/,
    isEmpty: function (input) {
    if (input===undefined||input===null||input==="") {
    return true;
    } else {
    return false;
    }
    },
    isType: function (type, input) {
    if (this.isEmpty(input)) {
    return false;
    } else {
    return type.test(input);
    }
    },
    isPhone: function (input) {
    return this.isType(this.regPhone, input);
    },
    isEmail: function (input) {
    return this.isType(this.regEmail, input);
    },
    isPositiveInt: function (input) {
    return this.isType(this.isPositiveInt, input);
    },
    isPositiveFloat2: function (input) {
    return this.isType(this.isPositiveFloat2, input);

    },
    }

  • 相关阅读:
    综合:bool类型 命名空间 输入输出
    C++命名空间
    C++输入输出
    C++新特性
    C++ IDE环境
    C++简介
    3 python3 编码解码问题 upd接受数据
    2 socket UDP通信
    1 网络基础知识
    15 GIL 全局解释器锁 C语言解决 top ps
  • 原文地址:https://www.cnblogs.com/tangsh/p/5095124.html
Copyright © 2011-2022 走看看