0

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" />

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.