This blog post is firstly published on my personal blogging site kanby.net

TL;DR

Most Common Patterns

Important: a x b in this example a is preceeding by x and b is followed by x

By combining these, you can create highly complicated pattern match/extraction functions with Regex.

Examples

  1. \^[a-z_]+\.com$\ will match .com domains
    • [a-z_] means characters from a to z and underscore

    • + means at least one of them

    • \. means period (.)

    • com is for just com

    • ^ and $ is for searching from the start of the string to the end of each line

  2. ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$ will match emails

If you have any questions, here is my Instagram @emrekanbay.en