Regular Expressions HTML5

How to declare :

<form action=”” method=”post”>
<label for=”username”>Create a Username: </label>
<input type=”text”
name=”username”
id=”username”
placeholder=”4 <> 10″
pattern=”[A-Za-z]{4,10}”/>
<button type=”submit”>Go </button>
</form>

Output :
This input field maintain [A-Za-z]{4,10} condition.
[A-Za-z]{4,10} accepts only upper and lowercase letters. This string must also have a minimum of four characters, and a maximum of ten.

Leave a Reply