-2

I just found out about Regex, so sorry if it's a noob question, but I want to use it in a webpage, so I tried it, and it didn't work. Is there a library? SDK? or line of code I am missing?? Here is the code I have, that isn't working in my bootstrap5 project:

 <input name="phone" type ="tel" id="phone" pattern="\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}" placeholder="xxx-xxx-xxxx phone" />

Thanks,

terere
  • 1
  • 1
  • `pattern` is used to validate when you submit a form. Are you looking for something when you enter data? – Jack Feb 21 '22 at 02:17
  • You can try [bootstrapvalidator](http://bootstrapvalidator.votintsev.ru/validators/regexp/) – Ian Feb 21 '22 at 02:28

1 Answers1

-1

Pattern is checked against on form submission.

So if you add form tag() and try submit, it will check your pattern

I confirmed your code is working in https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_pattern