Regex Flavour Matrix
Features
9
tracked
Engines
8
compared
Supported
47
yes cells
Unsupported
18
no cells
matrix · features × engines
| Feature | JS | PCRE | Python | Java | .NET | Go | Ruby | Rust |
|---|---|---|---|---|---|---|---|---|
| Named groups | ok | ok | ok | ok | ok | ok | ok | ok |
| Lookahead | ok | ok | ok | ok | ok | no | ok | no |
| Lookbehind | ok | partial | partial | partial | ok | no | partial | no |
| Atomic groups | no | ok | partial | ok | ok | no | ok | no |
| Possessive quantifiers | no | ok | partial | ok | no | no | ok | no |
| Unicode \p{} | ok | ok | partial | ok | ok | ok | ok | ok |
| Inline flags (?i) | no | ok | ok | ok | ok | ok | ok | ok |
| Backreferences | ok | ok | ok | ok | ok | no | ok | no |
| Conditionals | no | ok | ok | no | ok | no | ok | no |
notes · per-cell details
Named groups
JS ok
(?<name>…) since ES2018
PCRE ok
(?<name>…), (?P<name>…), (?'name'…)
Python ok
(?P<name>…)
Java ok
(?<name>…) since 7
.NET ok
(?<name>…)
Go ok
RE2: (?P<name>…)
Ruby ok
(?<name>…)
Rust ok
regex crate: (?P<name>…) or (?<name>…)
Lookahead
JS ok
(?=…) and (?!…)
PCRE ok
Full support
Python ok
Full support
Java ok
Full support
.NET ok
Full support
Go no
RE2 forbids lookaround (linear-time guarantee)
Ruby ok
Onigmo: full support
Rust no
regex crate is RE2-style; no lookaround
Lookbehind
JS ok
(?<=…), (?<!…) since ES2018; variable-width allowed
PCRE partial
Fixed-width; \K is the modern alternative
Python partial
Fixed-width in re; full in regex module
Java partial
Fixed-width; some impls allow bounded
.NET ok
Variable-width allowed
Go no
Not supported
Ruby partial
Onigmo: variable-width but with limits
Rust no
Not supported in standard regex crate
Atomic groups
JS no
Not supported in V8/SpiderMonkey
PCRE ok
(?>…)
Python partial
regex module yes; built-in re only in 3.11+
Java ok
(?>…)
.NET ok
(?>…)
Go no
RE2: not needed (no backtracking)
Ruby ok
(?>…)
Rust no
RE2-style: no atomic groups
Possessive quantifiers
JS no
Not in spec
PCRE ok
*+ ++ ?+ {n,m}+
Python partial
regex module yes; re in 3.11+
Java ok
Full support
.NET no
Not supported (use atomic groups)
Go no
RE2: not applicable
Ruby ok
Onigmo: supported
Rust no
Not supported
Unicode \p{}
JS ok
With u flag; \p{Script=…} requires modern engines
PCRE ok
With UCP
Python partial
re: limited; regex module: full
Java ok
Pattern.UNICODE_CHARACTER_CLASS
.NET ok
\p{IsBlock} and Unicode categories
Go ok
RE2: full Unicode property classes
Ruby ok
Onigmo: full support
Rust ok
regex crate: full Unicode support
Inline flags (?i)
JS no
Not supported (flags only on RegExp object)
PCRE ok
(?i), (?-i), scoped (?i:…)
Python ok
(?i), (?aiLmsux)
Java ok
(?i), (?-i), scoped (?i:…)
.NET ok
(?i), (?-i), scoped (?i:…)
Go ok
(?i), (?m), (?s), (?U)
Ruby ok
(?i), (?-i), scoped
Rust ok
(?i), (?x), (?m), (?s), (?U)
Backreferences
JS ok
\1, \k<name>
PCRE ok
\1, (?P=name), \g{name}
Python ok
\1, (?P=name)
Java ok
\1, \k<name>
.NET ok
\1, \k<name>
Go no
RE2 forbids backrefs (linear time)
Ruby ok
\1, \k<name>
Rust no
Not supported in regex crate
Conditionals
JS no
(?(cond)yes|no) not supported
PCRE ok
(?(1)yes|no), (?(<name>)yes|no)
Python ok
(?(id/name)yes|no)
Java no
Not supported
.NET ok
(?(expr)yes|no)
Go no
Not supported
Ruby ok
Onigmo: (?(cond)yes|no)
Rust no
Not supported