Skip to content

Instantly share code, notes, and snippets.

View jmail1014's full-sized avatar

Jessica jmail1014

View GitHub Profile

Regex Tutorial

Hi! I am going to explain regex. My regex example is an email identifier. You can use regex to identify or restrict certain kinds of emails, so this can be written in many ways. Mine will be for a simple and general email address.

Summary

The regex or regular expression I will be describing is ^\w+@[a-zA-Z_]+?.[a-zA-Z]{2,3}$, which defines a regular email address. I will explain what each section means and how it will define the email address it is looking for and what it will exclude. ^ is the beginning and just states this. \w will include any alphanumeric character including underscore. +@ includes one @ character.