-
Notifications
You must be signed in to change notification settings - Fork 935
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
Throws error when there's none #442
Comments
You need to match the whole string with ^ and $ otherwise js regexes try to find matches multiple times and store the last index. It's js regex quirk not a yup error it looks like |
It changes nothing, sorry. I tried it. |
The problem caused by
x = `/([A-Z]\d[A-Z]\s?\d[A-Z]\d)/gi`;
x.test('G0G0G0'); // => true
x.test('G0G0G0'); // => false I think current behaviour is unexpected. There are two ways to go:
I think the second option is all benefits and no drawbacks. Opened a PR. |
Hi, I do my validation on a controller and I test it with Jest. This is the exception thrown:
It been thrown on the second part of my test suite. The two are exactly the same, but the second fails.
And this is is the regex to validate
companyZipcode
without the escaped backslashes/([A-Z]\d[A-Z]\s?\d[A-Z]\d)/gi
What is going on? Did I forgot to reset the schema or something?
It do this on every second test case using validation on Zipcode/Postal Code.
Thank you very much for your help
The text was updated successfully, but these errors were encountered: