Skip to content

Instantly share code, notes, and snippets.

View matthew-millard's full-sized avatar

Matt Millard matthew-millard

View GitHub Profile
@matthew-millard
matthew-millard / regExpedition-gist.md
Last active July 4, 2023 15:49
Learn to match standard email addresses in this regex tutorial.

Email Validation 101: A Comprehensive Guide to Regular Expressions

In this tutorial, we are going to dive into the world of regular expressions (RegEx) and learn how to validate email addresses.

Summary

One common use case for RegEx is validating user input, such as email addresses. I'll specifically cover the pattern /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/, which is designed to match standard email addresses. This tutorial will break down the components of this regular expression, and demonstrate how to implement it in code to validate an email address.