Closed hiyuki closed 8 years ago
Sorry for my late reply.
Thanks for your reporting! I'll try to fix in v3. In v2, You can avoid with the custom validator. See the below documentation URL http://vuejs.github.io/vue-validator/en/custom.html
I think it's not a bug.
You should try
v-validate:verify="{required:true,pattern:'/^\\d{4}$/'}
Yeah, Yor're right. https://jsfiddle.net/kazupon/8m1d2847/2/
but, maybe the doc for v2 should be updated to address this problems?
the example still use \d
instead of \\d
.
https://github.com/vuejs/vue-validator/blame/dev/docs/en/api.md#L93
https://github.com/vuejs/vue-validator/blame/dev/docs/en/api.md#L517
vue & vue-validator version
1.0.24, 2.1.3
Reproduction Link
Steps to reproduce
v-validate:verify="{required:true,pattern:'/^\d{4}$/'}
What is Expected?
The pattern parsed correctly and validate for 4 numbers
What is actually happening?
the pattern parsed as /^d{4}$/ and only valid with input 'dddd'