diff --git a/src/common/regular.js b/src/common/regular.js new file mode 100644 index 00000000..b85a6935 --- /dev/null +++ b/src/common/regular.js @@ -0,0 +1,15 @@ +export default { + phone: /^((0\d{2,3}-\d{7,8})|((13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}))$/, + password: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*,.?_-])[\da-zA-Z~!@#$%^&*,.?_-]{8,16}$/, + money: /^([1-9]\d*|0)(\.\d{1,2})?$/, + area: { + village: /^\d{9}[^0]0{0,2}$/, + town: /^\d{6}[^0]0{0,2}000$/, + country: /^\d{4}[^0]0?0{6}$/, + city: /^\d{2}[^0]0?0{8}$/, + province: /^[^0]0?0{10}$/, + }, + zh: /^[\u4e00-\u9fa5]+$/, + email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, + ip: /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/ +} diff --git a/src/common/util.js b/src/common/util.js index 85d4d718..3e8f44f7 100644 --- a/src/common/util.js +++ b/src/common/util.js @@ -1,6 +1,7 @@ import dict from "./dict" import dayjs from './monent' import qs from 'query-string' +import reg from "./regular"; const confirm = (content, title, config) => { let ops = {content} @@ -306,5 +307,6 @@ export default { idCardNoUtil, qs, permissions, - copy + copy, + reg }