Determining whether or not a string matches specific criteria is a very common problem in programming, particularly in web development where it's important to ensure that, for instance, user login details fit specific rules. This tutorial will cover a method for ensuring that an input string matches the format for an email.
This is a quick guide to how regular expressions (regex) work and how they can be used in Javascript. For this tutorial I'll be explaining the regex below:
/^([a-z0-9_.-]+)@([\da-z-]+)\.([a-z]{2,6})$/