Skip to content
uencoder

Regex Engine Comparison Reference

Comparison of regex engines: PCRE, RE2, ECMAScript, .NET, Java, and Python re.

Engine Types

Backtracking engines (PCRE, Java, .NET, Python re, JS) support backreferences and lookaround but can have exponential worst-case time (ReDoS). NFA-based engines explore multiple paths via backtracking. DFA/automata engines (RE2, Rust regex) guarantee linear time but cannot support backreferences. Hybrid engines (Oniguruma) combine approaches. The choice of engine affects features, performance, and safety. RE2 is Google's linear-time engine used in Go and many tools.

backtracking
PCRE, Java, .NET
ReDoS risk
RE2
Linear time
no backreferences
hybrid
Oniguruma
combines approaches

Feature Matrix

Lookbehind: .NET (variable), PCRE 7.7+ (variable), JS 2018+ (variable), Java (fixed), Python (fixed). Named groups: all modern engines. Atomic groups: PCRE, Java, .NET, Oniguruma (not JS, not Python re). Unicode properties: PCRE, JS (/u), Java, .NET, Python 3 (re.UNICODE). Subroutine calls: PCRE, Perl, .NET (not JS, not RE2). Possessive quantifiers: PCRE, Java (not JS, not .NET, not Python). Backreferences: all backtracking engines (not RE2).

lookbehind
Varies by engine
fixed vs variable
atomic
PCRE/Java/.NET
not JS/Python
backrefs
Backtracking only
not RE2

Related tools

References