What patterns does in Html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What patterns does in Html?

Pattern is a type of input restriction. I was not able to understand what it does.

25th May 2017, 2:17 PM
Prajwal Agarwal
Prajwal Agarwal - avatar
3 Answers
+ 2
you may ask user to input his/her phone number in this case you may want them to enter with the pattern you have given like (212) 999 99 99 instead of 2129999999 or best to check user enters a correct email andreas E-mail: <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}
quot;>
25th May 2017, 2:31 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 2
The pattern attribute contains a regular expression. It specifies how exactly should the input content be. Including but not limited to : the length of the input entry, wethere it needs to contain uppercases, whether it should start with a specific word, whether​ it can contain special characters...and many other possibilities. Basically, this is used to take a thorough control over the recived input entry. a simple pattern looks like this : [a-zA-Z0-9] This expression disallows the use of special characters like underscores etc.
25th May 2017, 2:29 PM
CHMD
CHMD - avatar
0
Here is the example to use pattern only to validate password. https://code.sololearn.com/WwnmYKtR4Y3D/?ref=app
25th May 2017, 2:38 PM
Calviղ
Calviղ - avatar