Skip to content

验证是否是正则表达式,没有效果。 #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
HappyYawen opened this issue Jun 22, 2017 · 4 comments
Open

验证是否是正则表达式,没有效果。 #49

HappyYawen opened this issue Jun 22, 2017 · 4 comments

Comments

@HappyYawen
Copy link

{type:'regexp',required:true,message: '请输入正则表达式', trigger: 'blur'}
这样写没有验证效果。请问应该怎么使用?

@jruif
Copy link

jruif commented Jun 27, 2017

Must be an instance of RegExp or a string that does not generate an exception when creating a new RegExp

应该是缺少Pattern,试试这样:

{type:'regexp',required:true,message: '请输入正则表达式', trigger: 'blur', pattern: /\w+/g}

@chou0728
Copy link

@jruif
type要改成 string才有效果
{type:'string',required:true,message: '请输入正则表达式', trigger: 'blur', pattern: /\w+/g}

@xxssww0258
Copy link

[{ pattern: /^\d+$/, required: true, message: 'pattern这个字段就够了' }]

@ohroy
Copy link

ohroy commented Sep 2, 2023

望文生义了。。原来 regexp是验证输入的内容是否是正则表达式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants