This article contains notes for RegEx respectively Regular Expressions and also some useful ressources.

RegEx are not Regular Expressions in the narrower sense of the word but today both tearms are used more or less interchangably. More on that:

General Rules

Meta Characters
Meta Character Example
Single Character .
Character class digit \d
Character class character \w

Character class whitespace
(Space, tab, new line, carriage return)

Inversion of character classes (Not) \D, \W, \S
Word and text boundaries b ^ $
Range Example
Character class range [a-c]
Inversion of character class range [^abc]
Quantifier Example
Zero or one character ?
Zero or more characters (Kleene Star) *
One or more characters (Kleene Plus) +
Three characters {3}
Four to 20 characters {4,20}

White Space Characters
White Space Example
Space _
Tab \t
New line \n
Carriage return \r
Any white space character \s

Line start and end
Type Example
Start of line ^
End of line $

Groups and nested groups
Type String Expression Results
Group Example 1 IMG1000.png ^(IMG\d+\.png)$ IMG1000.png
Group Example 2 IMG1000.png ^(IMG\d+)\.png$ IMG1000
Nested group IMG1000.png ^(IMG(\d+))\.png$

Group 1: IMG1000
Group 2: 1000

Multiple groups 1920x1080 (\d+)x(\d+)

Group 1: IMG1000
Group 2: 1000

Grouping with alternatives Monday or Tuesday (Mon|Tues)day

Match 1: Monday
Group 1: Mon
Match 2: Tuesday
Group 2: Tues

Online Regex Tools

Tutorials and Guides

Guide (german):

Quick Start Cheat Sheet:

Advanced tutorial:

Practical tutorial:

Regex with JavaScript: