This gist will feature the regular expression (regex) used for recognizing email addresses in order to explain the functionality of each of the different components that can be used to build a regex.
I will be breaking down each component of the following regex to explain, step-by-step, what the individual component can do generally, as well as what is doing specifically for the email address regex. Please note that, in each section below, I will not be covering how the given component interacts with other components. I will cover that at the end of the gist. For now, I will only mention what the given component accomplishes. The regex we will be exploring in this gist is:
/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/