const reg = {
// 验证固话
TEL: /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/,
// 验证手机号
MOBILE: /^1[3|4|5|7|8][0-9]\d{4,8}$/,
// 验证邮箱
EMAIL: /^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$/,
// 验证汉字
CHINESE: /^[\u4e00-\u9fa5],{0,}$/,
// 验证身份证
IDCARD: /(^\\d{18}$)|(^\\d{15}$)/,
// 表示字符串不含空格
SPACE:/^[\s]*$/,
// 表示字符串不含空格及其它空白字符
SPACEMORE:/^[^\s]*$/,
// 验证数字
NUMBER:/^[0-9]*$/
};
Last active
February 4, 2018 02:38
-
-
Save xydiva/0b528c5326240c6033a4aaec63cfcde4 to your computer and use it in GitHub Desktop.
前端常用正则表达式
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment