// 校验手机号 严格
export const StrictMobileReg =
  /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/

// 校验手机号 宽松
export const MobileReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
// 校验座机好吗
export const TelPhoneReg = /0\d{2,3}-\d{7,8}(-\d{1,6})?/

// 座机
export const TelReg = /^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/

// 手机或座机
export const PhoneReg = /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/

// 数字/货币金额 (只支持正数、不支持校验千分位分隔符)
export const CurrencyReg =
  /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0){1}$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/

//1~10000的正整数
export const max10000 = /^[1-9]\d{0,3}$|^10000$/

//链接地址
export const UrlReg = /^((ht|f)tps?):\/\/[\w-]+(\.[\w-]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?$/
// 身份证
export const IdCardReg =
  /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dX]$/

// 校验邮箱地址
export const EmailReg =
  /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/

// 数字和字母的组合
export const LetterNumberReg = /^[a-z0-9]+$/

// 校验车牌号
export const CarNumReg =
  /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/

//版本号校验
export const VersionReg = /^[1-9]\d?(\.(0|[1-9]\d?)){2}$/

//只能输入中文和数字
export const ChineseOrNumber = /^[\u4E00-\u9FA5A-Za-z0-9_]+$/

// 是否全部为中文
export const ChineseReg = /^[\u4e00-\u9fa5]+$/

// 是否包含为中文
export const IncludesChineseReg = /[\u4e00-\u9fa5]+/

export const SpecialCharacters =
  // eslint-disable-next-line no-useless-escape
  /[`~!@#$%^&*()_\-+=<>?:"{}|,\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]/im

export const number = / ^[0-9]*$ /

//检验double
//double 类型整数位不能超过20位(算上符号位),小数位不能超过15 位,这样加起来,double 类型 最大长度位为36 位, 算上小数点
export const doubleReg = /^[0-9]{1,20}([.][0-9]{1,15})?$/

 

相关文章:

猜你喜欢
  • 2021-07-13
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2022-03-09
相关资源
相似解决方案