Regex syntax at a glance
characters
.Any character except newline\dNumber\wWord character\sWhitespace\DNot a digit\WNot a word character\SNot whitespace[abc]a, b or c[^abc]Not a, b or c[a-z]a to z\p{L}Any letter (needs u)[\u4e00-\u9fff]Chinese characters
Location
^Start$End\bWord boundary\BNot a word boundary
Quantity
*0 or more+1 or more?0 or 1{3}Exactly 3{2,}2 or more{2,5}2 to 5*?Lazy: as few as possible
Groups and references
(abc)Capture Group(?:abc)Non-capturing group(?<name>abc)Named capture group\1Back-reference to group 1\k<name>Back-reference by namea|ba or b
Lookarounds
(?=abc)Followed by abc(?!abc)Not followed by abc(?<=abc)Preceded by abc(?<!abc)Not preceded by abc
Escapes
\.A literal dot\/A literal slash\nNewline\tTab\u00A9Unicode character
Replacement syntax
$1 $2Groups 1 and 2$<name>Named group$&The whole match$`Text before the match$'Text after the match$$A literal $
How to use it
- 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.