input type regex code example
Example 1: name validation html
<input type="text" pattern="[a-zA-Z'-'\s]*">
Example 2: regex on input
<form>
<label for="username">Username <i>(letters and numbers only, no punctuation or special characters)</i></label><br>
<input name="username" id="username" pattern="[A-Za-z0-9]+">
</form>