Skip to content
Free Tool Arena

Glossary · Definition

Regex flavors comparison

Regex isn’t one universal language — each engine has its own features. JavaScript ECMAScript (browser/Node): standard. Python re: similar + named groups. PCRE (PHP, Perl, Java): adds recursion + possessive quantifiers. Go RE2: linear-time guaranteed but no lookbehind / backreferences.

Updated May 2026 · 4 min read
100% in-browserNo downloadsNo sign-upMalware-freeHow we keep this safe →

Definition

Regex isn’t one universal language — each engine has its own features. JavaScript ECMAScript (browser/Node): standard. Python re: similar + named groups. PCRE (PHP, Perl, Java): adds recursion + possessive quantifiers. Go RE2: linear-time guaranteed but no lookbehind / backreferences.

What it means

<strong>JavaScript ECMAScript</strong> regex: lookbehind (added in ES2018), named groups, Unicode property classes (<code>\p&#123;Letter&#125;</code>). No recursion, no possessive quantifiers. Used in browsers and Node. <strong>Python re</strong>: similar to JS, adds named-group dict access and conditional patterns. PCRE2 features available in <code>regex</code> module (third-party). <strong>PCRE</strong> (PHP, Java, .NET, Apache): full feature set including recursion (<code>(?R)</code>), possessive quantifiers (<code>*+</code>), branch reset, balancing groups (.NET only). Used in mod_rewrite, log analysis. <strong>Go RE2</strong>: based on RE2 engine, guarantees linear-time matching (no catastrophic backtracking), but cannot do lookbehind or backreferences. Trade features for safety.

Advertisement

Why it matters

Patterns that work in one engine may fail in another. Common gotchas: PCRE recursion <code>(?R)</code> doesn&rsquo;t work in JS. JS positive lookbehind <code>(?&lt;=...)</code> requires Node 10+. Go RE2 rejects lookbehind. When integrating regex from blog posts or Stack Overflow, always check whether it was written for your target engine. Server-side log processing using Go RE2 needs RE2-compatible patterns; PCRE patterns will fail.

Example

Recursion (PCRE only): <code>(?R)</code> matches the whole pattern recursively (used for nested-bracket matching). Translates to: not directly possible in JavaScript (need to use a parser instead). Lookbehind (JS, PCRE): <code>(?&lt;=USD\s)\d+</code> matches digits after &lsquo;USD &lsquo;. Translates to: not possible in Go RE2 (use post-processing instead).

Related free tools

Frequently asked questions

Which engine is fastest?

Depends on pattern. PCRE is slowest in worst case (exponential backtracking on adversarial input). RE2 is consistently fast (linear). JavaScript varies — modern V8 has good optimizations for common patterns.

Should I use PCRE if available?

More features but slower in worst case. For untrusted input (user-submitted patterns), use RE2 or limit pattern complexity. For trusted patterns, PCRE&rsquo;s features can simplify implementation.

What about ICU regex?

International Components for Unicode (ICU) regex is used by some platforms (Java&rsquo;s java.util.regex is ICU-influenced). Excellent Unicode support. Less common in web/mobile contexts.

Related terms