0

I have a HTML form with a telephone input. I have created a regex pattern that I believe suit my needs.

<input type="tel" pattern="(\+\d{2})?[-. ]?[0-9]{3}?[-. ]?([0-9]{3})[-. ]?([0-9]{4})"/>

The pattern is correct, according to my understanding.

However, if you test it with an erroneous value like qqqqq, the field validation succeeds and the form is posted, since Chrome version 114. With Chrome versions up to 113, the validation failed saying, Please match the requested format. If you switch the pattern to something simpler like [0-9]{10}, the validation works normally.

Am I missing something, or is this a bug in Chrome?

1: https://regex101.com/r/WWKtna/1

mavrosxristoforos
  • 3,573
  • 2
  • 25
  • 40

0 Answers0