Skip to content

Instantly share code, notes, and snippets.

Matching an Email - Regex Tutorial Piece by Piece

Regex is defined as a regular expression. In other words it is a character sequence that can be used in search pattern, to find or replace characters in a given text or to validate input.

It is widely used in extracting information from any text or paragraphs. Regex is also used in code, search algorithms and validation in diffrent types of programming languages

Summary

We will be discussing on Matching an Email code snippet –

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

Breaking this code snippet in 3 small pieces may help easily understand components and their importance in specific location.