This is acomparison ofregular expression engines.
Language | Official website | Software license | Remarks |
---|---|---|---|
ActionScript 3 | ActionScript Technology Center | Free | |
APL (APLX, Dyalog, GNU) | APL Wiki | Licensed by the respective implementation | ⎕SS (PCRE),⎕R /⎕S (PCRE),⎕SS (PCRE2), respectively |
C++11 (C++) | C++ standards website | Licensed by the respective implementation | Since ISO14822:2011(e), similar to ECMAScript on default(Grammar Description) |
D | D | Boost Software License[Note 1] | |
Elixir | elixir-lang.org | Apache 2.0 | Standard library includes PCRE-basedRegex module. The matching algorithms of the library are based on the PCRE library, but not all of the PCRE library is interfaced and some parts of the library go beyond what PCRE offers. Currently PCRE version 8.40 (release date 2017-01-11) is used. |
Erlang | erlang.org | Apache 2.0 | Standard library includes PCRE-basedre module. The matching algorithms of the library are based on the PCRE library, but not all of the PCRE library is interfaced and some parts of the library go beyond what PCRE offers. Currently PCRE version 8.40 (release date 2017-01-11) is used. |
Free Pascal (Object Pascal) | freepascal.org | LGPL with static linking exception | Free Pascal 2.6+ ships with TRegExpr from Sorokin and two other regular expression libraries; Seewiki.lazarus.freepascal.org/Regexpr. |
Go | go.dev | BSD-style | |
Haskell | Haskell.org | BSD3 | Omitted in the language report, and in GHC's Hierarchical Libraries |
Java | Java | GNU General Public License | REs are written as strings in source code: all backslashes must be doubled, harming readability. |
JavaScript (ECMAScript) | ECMA-262 | BSD3 | Limited but REs are first-class citizens of the language with a specific/.../mod syntax. |
Julia | JuliaLang.org | MIT License | REs are part of the language core library using PCRE built-in and an optional wrapper for (C code) ICU is available. |
Lua | Lua.org | MIT License | Uses simplified, limited dialect; can be bound to more powerful library, like PCRE or an alternative parser like LPeg. |
Mathematica | Wolfram | Proprietary | |
.NET | MSDN | MIT License[Note 2][Note 3] | |
Nim | nim-lang.org | MIT License | Standard library includes PCRE-basedre andnre modules, as well as various alternatives (ex.strutils,pegs (Parsing Expression Grammar matching),strscans,parseutils, etc.). |
OCaml | Caml | LGPL | As of 2010[update], the standard module is generally regarded as deprecated;[2] often recommended libraries arepcre (with full support for PCRE) andre (which is not as complete but claims better performance and provides frontends to popular syntaxes: PCRE, Perl, Posix, Emacs, shell globbing). |
Perl | Perl.com | Artistic License, orGNU General Public License | Full, central part of the language |
PHP | PHP.net | PHP License | Has two implementations, with PCRE being the more efficient in speed, functions |
POSIX C (C) | POSIX.1 web publication | Licensed by the respective implementation | SupportsPOSIX BRE and ERE syntax |
Python | python.org | Python Software Foundation License | Python has two major implementations, the built inre and theregex library. |
Ruby | ruby-lang.org | GNU Library General Public License | Ruby 1.8, Ruby 1.9, and Ruby 2.0 and later versions use different engines; Ruby 1.9 integrates Oniguruma, Ruby 2.0 and later integrate Onigmo, a fork from Oniguruma. |
Rust | docs.rs | MIT License | The primary regexcrate does not allow look-around expressions. There is an Oniguruma binding calledonig that does. |
SAP ABAP | SAP.com | Proprietary | |
Tcl | tcl.tk | Tcl/Tk License (BSD-style) | Tcl library doubles as a regular expression library. |
Wolfram Language | Wolfram Research | Proprietary: usable for free on a limited scale on the Wolfram Development platform | |
XML Schema | W3C | Licensed by the respective implementation | |
XPath 3/XQuery | W3C | Licensed by the respective implementation |
NOTE: An application using a library for regular expression support does not necessarily support the full set of features of the library, e.g., GNUgrep uses PCRE, but supports no lookahead, though PCRE does.
"+" quantifier | Negated character classes | Non-greedy quantifiers [Note 1] | Shy groups [Note 2] | Recursion | Look-ahead | Look-behind | Backreferences [Note 3] | >9 indexable captures | |
---|---|---|---|---|---|---|---|---|---|
Boost.Regex | Yes | Yes | Yes | Yes | Yes[Note 4] | Yes | Yes | Yes | Yes |
Boost.Xpressive | Yes | Yes | Yes | Yes | Yes[Note 5] | Yes | Yes | Yes | Yes |
CL-PPCRE | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
EmEditor | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | No |
FREJ | No[Note 6] | No | Some[Note 6] | Yes | No | No | No | Yes | Yes |
GLib/GRegex | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
GNUgrep | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | — |
Haskell | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
RXP | Yes | Yes | Yes | Yes | No | No | No | Yes | Yes |
ICU Regex | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
Java | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
JavaScript (ECMAScript) | Yes | Yes | Yes | Yes | No | Yes | Yes[Note 7] | Yes | Yes |
JGsoft | Yes | Yes | Yes | Yes | Yes[3] | Yes | Yes | Yes | Yes |
Lua | Yes | Yes | Some[Note 8] | No | No | No | No | Yes | No |
.NET | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
OCaml | Yes | Yes | No | No | No | No | No | Yes | No |
PCRE | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Perl | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
PHP | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Python | Yes | Yes | Yes | Yes | Yes[Note 9] | Yes | Yes | Yes | Yes |
Qt/QRegExp | Yes | Yes | Yes | Yes | No | Yes | No | Yes | Yes |
RE2 | Yes | Yes | Yes | Yes | No | No | No | No | Yes |
Ruby, Onigmo | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
TRE | Yes | Yes | Yes | Yes | No | No | No | Yes | No |
Vim | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | No |
RGX | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
Tcl | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
TRegExpr | Yes | ? | Yes | ? | ? | ? | ? | ? | ? |
XML Schema | Yes | Yes | No | — | No | No | No | No | — |
XPath 3/XQuery | Yes | Yes | Yes | Yes | No | No | No | Yes | Yes |
XRegExp | Yes | Yes | Yes | Yes | No | Yes | Yes[Note 7] | Yes | Yes |
-
, which is a non-greedy version of*
. It does not have non-greedy versions of+
or?
; in the former case, the non-greedy effect can be achieved by repeating the token followed by-
, but in the latter case, there is no equivalent.Directives [Note 1] | Conditionals | Atomic groups [Note 2] | Named capture [Note 3] | Comments | Embedded code | Unicode property support[4] | Balancing groups [Note 4] | Variable-length look-behinds [Note 5] | |
---|---|---|---|---|---|---|---|---|---|
Boost.Regex | Yes | Yes | Yes | Yes | Yes | No | Some[Note 6] | No | No |
Boost.Xpressive | Yes | No | Yes | Yes | Yes | No | No | No | No |
CL-PPCRE | Yes | Yes | Yes | Yes | Yes | Yes | Some[Note 6] | No | No |
EmEditor | Yes | Yes | ? | ? | Yes | No | ? | No | No |
FREJ | No | No | Yes | Yes | Yes | No | ? | No | No |
GLib/GRegex | Yes | Yes | Yes | Yes | Yes | No | Some[Note 6] | No | No |
GNUgrep | Yes | Yes | ? | Yes | Yes | No | No | No | No |
Haskell | ? | ? | ? | ? | ? | No | No | No | No |
RXP | Yes | Yes | No | Yes | Yes | No | No | No | No |
ICU Regex | Yes | No | Yes | Yes[Note 7] | Yes | No | Yes | No | No |
Java | Yes | No | Yes | Yes[Note 8] | Yes | No | Some[Note 6] | No | No |
JavaScript (ECMAScript) | No | No | No | Yes | No | No | Some[Note 6][Note 9][5] | No | Yes |
JGsoft | Yes | Yes | Yes | Yes | Yes | No | Some[Note 6] | No | Yes |
Lua | No | No | No | No | No | No | No | No | No |
.NET | Yes | Yes | Yes | Yes | Yes | No | Some[Note 6] | Yes | Yes |
OCaml | No | No | No | No | No | No | No | No | No |
PCRE | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
Perl | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No[Note 10] |
PHP | Yes | Yes | Yes | Yes | Yes | No | No | No | No |
Python | Yes | Yes | Yes[Note 11] | Yes | Yes | No | Yes[Note 12] | No | Yes[Note 13] |
Qt/QRegExp | No | No | No | No | No | No | No | No | No |
RE2 | Yes | No | ? | Yes | No | No | Some[Note 6] | No | No |
Ruby, Onigmo | Yes | Yes | Yes | Yes | Yes | No | Some[Note 6] | No | No |
Tcl | Yes | No | Yes | No | Yes | No | Yes | No | No |
TRE | Yes | No | No | No | Yes | No | ? | No | No |
Vim | Yes | No | Yes | No | No | No | No | No | Yes |
RGX | Yes | Yes | Yes | Yes | Yes | No | Yes | No | No |
XML Schema | No | No | No | No | No | No | Yes | No | No |
XPath 3/XQuery | No | No | No | No | No | No | Yes | No | No |
XRegExp | Leading only | No | No | Yes | Yes | No | Yes | No | Yes |
NativeUTF-16 support[Note 1] | NativeUTF-8 support[Note 1] | Multi-line matching | Partial match[Note 2] | |
---|---|---|---|---|
Boost.Regex | No | No | Yes | Yes |
GLib/GRegex | Yes | Yes | Yes | Yes |
RXP | Yes | Yes | No | Yes |
ICU Regex | Yes | No | Yes | ? |
Java | Yes[Note 3] | Yes[Note 3] | Yes | Yes |
.NET | No[Note 4] | Yes | Yes | ? |
PCRE | Yes[Note 5] | Yes | Yes | Yes |
Qt/QRegExp | Yes | No | No | Yes[Note 6] |
Qt/QRegularExpression | Yes | Yes | Yes | Yes |
Tcl | Yes | Yes[Note 7] | Yes | ? |
TRE | Yes | Yes | Yes | ? |
RGX | No | No | Yes | ? |
wxWidgets::wxRegEx[Note 8] | Yes | Yes | Yes | ? |
XRegExp | Yes | Yes | Yes | No |