Regex Cheat Sheet
A quick reference of regular expression syntax with character classes, quantifiers, anchors, groups, lookaround and escapes.
How to use
Using the cheat sheet
Search for a token or a description to filter the table, then use the pattern directly in JavaScript, Python or any engine that follows the common syntax.
- Search for a pattern or keyword.
- Read the description.
- Copy the token into your expression.
Frequently asked questions
Which regex flavour is this?
The common Perl-compatible subset supported by JavaScript, Python, Java and most other engines.
Does the dot match newlines?
By default it does not. Enable the s (dotAll) flag in JavaScript or re.DOTALL in Python if you need it to.
Related tools
Regex Tester
Test regular expressions against sample text and inspect every match and capture group.
Word & Character Counter
Count characters, words, lines, sentences and paragraphs, with reading time and UTF-8 size.
UUID / GUID Generator
Generate random version 4 UUIDs and copy them one by one or in bulk.
Hash Generator
Compute MD5, SHA-1, SHA-256 and SHA-512 digests of any text.
Timestamp Converter
Convert between Unix timestamps, ISO 8601 and human readable local dates.
Text Compare / Diff
Compare two blocks of text and see line level additions, removals and changes.