Cheat sheet for basic regex expressions and websites

regex101

Regex ExpressionFunction
\drepresents any digit 0 to 9
.matches any single character as a wildcard
[abc]only matches a,b,c a single time, nothing else
[^abc]matches everything except a,b or c
\wmatches A-Za-z0-9
[0-6]matches every number between 0 and 6
[a-d]matches every character between a and d
a{3}a must be there 3 times
a{2-6}a can be there 2 to 6 times
\d*any amount of numbers
\d+any amount of numbers but at least one
ab?cb is an optional character, either abc or ac
\tmatches a tab
\nrepresents a new line
\rcarriage return
\smatches ANY whitespace
^abcexpression starts with abc
abc$and ends with abc
^(file.+).pdf$matches a file beginning with “file” and ends with “.pdf”. Only captures filename!
^(file.+.pdf$)matches a file beginning with “file” and ends with “.pdf”. Captures both!
(\w+ (\d+))matches “Jan 1987” as “Jan 1987” and “1987”
(\d+)x(\d+)captures everything divided by “x” and splits into two groups
Pipeor symbol
Last modified 2022.01.01