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

Code Example 1

[1-9][0-9]{3}\s?[a-zA-Z]{2}

Learn ReactJs, React Native from akashmittal.com