Reputation: 435
I tried the following regular expression
newData.val().matches(/(^\d{5}$)|(^\d{5}-\d{4}$)/)
I get an error that the escape character \d
isn't recognized. I removed and cleared the errors but I still get a permission denied error.
Upvotes: 1
Views: 187
Reputation: 9389
You must use double slashes \\
.
It will look like
newData.val().matches(/(^\\d{5}$)|(^\\d{5}-\\d{4}$)/)
Take some time observing some of the examples that you can find on the documentation.
Upvotes: 2