Syntax grouped by characters, anchors, quantifiers, groups, lookarounds, escapes and replacements; click any item to insert it into the tester above and see it work on real text.
◈ Runs locally · text is not uploaded
//
Match Details
Unit tests
One string per line. Saved with the share link, so you see at once if a change breaks a case.
Explanation
Flavour compatibility
Checks whether the syntax in your pattern works as-is in JavaScript, PHP, Python, Java, C# and Go.
Common patterns
Code
Cheat sheet (click to insert)
characters
Any character except newline
Number
Word character
Whitespace
Not a digit
Not a word character
Not whitespace
a, b or c
Not a, b or c
a to z
Any letter (needs u)
Chinese characters
Location
Start
End
Word boundary
Not a word boundary
Quantity
0 or more
1 or more
0 or 1
Exactly 3
2 or more
2 to 5
Lazy: as few as possible
Groups and references
Capture Group
Non-capturing group
Named capture group
Back-reference to group 1
Back-reference by name
a or b
Lookarounds
Followed by abc
Not followed by abc
Preceded by abc
Not preceded by abc
Escapes
A literal dot
A literal slash
Newline
Tab
Unicode character
Replacement syntax
$1 $2Groups 1 and 2
$<name>Named group
$&The whole match
$`Text before the match
$'Text after the match
$$A literal $
YOUR NEXT STEP
Connect useful tools with your company workflow
Create a company account to configure website monitoring, business email and notifications, and invite your team to work together.
Type the pattern and switch on the flags you need (usually g and i).
Paste text; matches highlight live and the table lists each position and group.
Switch to Replace to rewrite text or Extract list to collect matches, then copy the code for your language.
Frequently asked questions
Greedy vs lazy?
By default * + {n,} are greedy and take as much as possible; adding ? makes them lazy. In the text x1y x2y, x.*y matches everything while x.*?y stops at the first y.
Which regex flavour is this?
Your browser's JavaScript (ECMAScript 2024) syntax, with named groups, lookarounds and Unicode properties \p{…}. Most of it is the same in Python, PHP (PCRE), Java and C#; Go lacks lookarounds and back-references. The Code panel rewrites named groups and similar differences per language.
Is my text uploaded?
No. Matching runs in a separate thread in your browser and stops after 1 second to guard against catastrophic backtracking; nothing is sent to a server.
regex cheat sheet practical guide and common questions
What does a regex cheat sheet do?
The sheet follows your browser's JavaScript (ECMAScript 2024) syntax, including named groups (?<name>…), lookarounds and Unicode properties \p{…}; every item can be inserted into the tester to try.
Who is this for, and when is it useful?
Developers, marketers and analysts writing data cleaning, form validation, log analysis or SEO rules who forget a piece of syntax and want to check it immediately.
How do I use this regex cheat sheet?
Syntax grouped by characters, anchors, quantifiers, groups, lookarounds, escapes and replacements; click any item to insert it into the tester above and see it work on real text.
How should I interpret the results?
Most syntax is the same in Python, PHP, Java and C#; Go (RE2) has no lookarounds or back-references, and Python writes named groups as (?P<name>…).
Where is the work performed, and which services receive data?
The cheat sheet and tester run in your browser; test text is never uploaded to any server.