pattern attribute was introduced for the
input fields. This enables us to use regex for making validation checks, and in this recipe we will take a look at some of the elements that can be used in it.
In this example, we will create a form using simple HTML as follows:
bodysection, starting with the Username field:
<div> <label> Username: <input type="text" title="only letters allowed" name="username" pattern="^[a-zA-Z]+$" /> </label> </div>
<div> <label> Phone <input type="tel" name="phone" pattern="[\+]?[1-9]+" /> ...