Reputation: 4907
I have an input that I'm trying to validate using a pattern attribute, but it's not working as a standard regular expression. How are these things handled differently?
See: http://jsfiddle.net/danwoods/yf7rnop1
I'm adding code here because it's required by StackOverflow; for a working example of the issue, please see the fiddle:
<input type="text" required pattern="\s?-?[0-9]+.?[0-9]*\s?,\s?-?[0-9]+.?[0-9]\s?" value="39.75323, -104.99197" />
Upvotes: 0
Views: 40
Reputation: 733
According to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
The pattern must match the entire value, not just some subset.
You're missing a *
after the last [0-9]
so the pattern does not match the entire string.
Upvotes: 1