Skip to content

Instantly share code, notes, and snippets.

@maplesyrupman
maplesyrupman / emailRegex.md
Last active January 24, 2022 07:41
Email Regex Breakdown

Email Regex Breakdown

Below, we'll be breaking down a regular expression used to match emails in order to develop our understanding of regular expressions.

Summary

The following regular expression can be used to match an email in a string: /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/

Emails are always made up of three components, which makes them fairly simple to write a search regex for.