Duncan Wither

Home Notes Github LinkedIn

Regex Cheat Sheet

Written: 05-Mar-2022

Regex is useful. This cheat-sheet is a condensation of Amit Chaudhary’s useful article. Also of note/inspiration is this regex cheat-sheet

cat matches any instance of the letters c then a then t. This includes both cat the word and the first three letters of cathartic.

There are some special chars for fun things…

Groups:

Wildcards:

Iterations:

Anchors:

Special Chars

Lookaround (More Advanced)

If you want to match something thats defind by what or what does preced or procede then you need to use lookahead operators. There’s a good regex buddy article explaining this.

Note look behind requires static length (no escapes or .*).

Online help