mljr.eu

REGEX LAB

PCREGo
QUICK REFERENCE
Anchors
^start of line / string
$end of line / string
\bword boundary
\Bnon-word boundary
Characters
.any char (s flag: incl. \n)
\d / \Ddigit / non-digit
\w / \Wword char / non-word
\s / \Swhitespace / non-ws
[abc]character class
[^abc]negated class
[a-z]range
Quantifiers
* + ?0+, 1+, 0-1 (greedy)
{n}exactly n
{n,m}n to m (greedy)
*? +? ??lazy (non-greedy)
Groups
(abc)capture group
(?:abc)non-capturing
(?P<n>abc)named capture
Lookaround · PCRE
(?=abc)positive lookahead
(?!abc)negative lookahead
(?<=abc)positive lookbehind
(?<!abc)negative lookbehind
Backrefs · PCRE
\1 \2backref in pattern
$1 $2backref in replace
${name}named group in replace
//
■ 2 matches
HIGHLIGHTED
The quick brown fox
jumps over the lazy dog
Pack my box with five dozen liquor jugs
MATCHES
0
quick
4–9
↳ group 1: "quick"
1
lazy
35–39
↳ group 1: "lazy"

PCRE-compatible engine (regexp2/v2) — backreferences, lookahead/lookbehind, atomic groups, Unicode. Flags: i=case-insensitive m=multiline s=dot-matches-newline.