Check out example codes for "name validation html". It will help you in understanding the concepts better.

Code Example 1

<input type="text" pattern="[A-Za-z]{3}">

Code Example 2

<input type="text" pattern="[a-zA-Z'-'\s]*">

Learn ReactJs, React Native from akashmittal.com