常用正则集合

2021-09-02  本文已影响0人  八妹sss

// 验证相关
/* eslint-disable /
fillValidType: [
{
type: 'text',
// 【注】此正则只判断是否含有表情,如果含有,就不是纯文本
reg: /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/,
tip: 'fill_text'
},
{
type: 'number',
reg: /^[0-9]
/, tip: 'fill_number' }, { type: 'en', reg: /^[a-zA-Z]*/,
tip: 'fill_en'
},
{
type: 'cn',
reg: /^[\u4e00-\u9fa5]/, tip: 'fill_cn' }, { type: 'email', reg: /^\w+((-w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+/,
tip: 'fill_email'
},
{
type: 'phone',
reg: /^1\d{10}/, tip: 'fill_phone' }, { type: 'url', reg: /^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/,
tip: 'fill_url'
},
{
type: 'indentification',
reg: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)/,
tip: 'fill_indentification'
}
]
/
eslint-disable */

上一篇下一篇

猜你喜欢

热点阅读