Regex Overview Examples

Usage in different languages

As the actual use of regular expressions is quite language specific there are separate cheat sheets:

Standards

Regex Variants

VariantUsed ByMeta CharactersBack References
POSIX BREgrep, sed ^ $ \{\} \[\] \(\) . *
GNU extension: \+ \?
\1 ... \9
POSIX EREegrep, awk ^ $ {} [] () . * + ? | gawk: \\1 .. \\9
Perl REPerl, C, PHP, Python, Ruby...
Every programming language using PCRE
^ $ {} () . * + ? | Based on language
Perl \g1 \g2 ...
\g-1 \g-2 ...
\g{-1} \g{-2} ...
\g{name}
\k{name}
\g'name'
\k'name'
PHP \\1 .. \\9
$1 .. $99
${1} .. ${99}
Python \1 .. \99
\g1 .. \g99
\g
(?P...)
(?P=name)

Other Hints: