Merge pull request #543 from RickCole21/master

正则验证添加特殊判断
This commit is contained in:
liaoxuezhi 2020-04-10 10:05:42 +08:00 committed by GitHub
commit cdf3f9dd6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ const isEmpty = (value: any) => value === '';
const makeRegexp = (reg: string | RegExp) => {
if (reg instanceof RegExp) {
return reg;
} else if (/^\/(.+)\/([gimuy]*)$/.test(reg)) {
} else if (/^(?:matchRegexp\:)?\/(.+)\/([gimuy]*)$/.test(reg)) {
return new RegExp(RegExp.$1, RegExp.$2 || '');
} else if (typeof reg === 'string') {
return new RegExp(reg);