Skip to content

Instantly share code, notes, and snippets.

View bdrawe's full-sized avatar

Bryce Drawe bdrawe

View GitHub Profile

Regex Tutorial

Regular Expressions, or more commonly referred to as Regex, is a way to use characters to match a pattern in a string. These can be useful for user input validation or implementing a find and replace feature in your app.

Summary

The use case I will be showing is validating a user's email.

/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/

I know this might look like egyptian writing, but don't worry, I will go through each character and how it works and how they all work together to validate an email.