This is a comparison of regular expression engines.

Libraries

List of regular expression libraries
NameOfficial websiteProgramming languageSoftware licenseUsed by
Boost.RegexC++BoostNotepad++ >= 6.0.0, EmEditor
Boost.XpressiveC++Boost
DEELXC++Proprietary
FREJJavaLGPL
GLib/GRegexCLGPL
GNU regexCLGPLGNU libc, GNU programs
GRETAC++Proprietary
RTL, HLSProprietaryFPGA accelerated >100 Gbit/s regex engine for cybersecurity, financial, e-commerce industries.
HyperscanC, x86-specific assembly (SSSE3+)3-clause BSDRspamd
ICUC, C++Foundation (Apple and Swift open-source versions)
IrregexpC++3-clause BSDChrome, Firefox, Node.js
Jakarta RegexpJavaApache
java.util.regexJavaGNU GPLv2 with Classpath exceptionjEdit
JRegexJavaBSD
MATLABProprietary
OnigurumaCBSDAtom, Take Command Console, Tera Term, TextMate, Sublime Text, SubEthaEdit, EmEditor, jq, Ruby
Java port of OnigurumaJavaMITJRuby, Nashorn (JavaScript engine)
PattwoStevesoftJava (compatible with Java 1.0)LGPL
PCREC, C++BSDApache HTTP Server, Nginx, BBEdit, Edbrowse, Julia, HHVM, Notepad++ < 6.0.0, PHP, Delphi, R, Exim, SWI-Prolog, Elixir, Erlang
Qt/QRegExp2013-12-12 at the Wayback MachineC++, ,Kate, Kile
regex - Henry Spencer's regular expression librariesCBSD
RE2C++BSDGo, Google Sheets, Gmail, G Suite
Henry Spencer's Advanced Regular ExpressionsCBSD
RGXC++ based component library
RXPRTLProprietaryhardware-accelerated search acceleration using RegEx available for ASIC, FPGA and cloud. Enables massively parallel content processing at ultra-high speeds.
SubRegCMIT
TPerlRegExObject PascalMPLv1.1
TRECBSDmusl
TRegexJavaUPL-1.0GraalVM
TRegExpr, , ()Object PascalDual-license: freeware, or LGPL with static linking exceptionTotal Commander
Wolfram Language (Mathematica)Wolfram LanguageProprietaryMathematica, the Wolfram Development Platform
XRegExpJavaScriptMIT
YARRC++2-clause BSDSafari, WebKit-based browsers, QML

Languages

List of languages and frameworks including regular expression support
LanguageOfficial websiteSoftware licenseRemarks
ActionScript 3Free
APL (APLX, Dyalog, GNU)Licensed by the respective implementation⎕SS (PCRE), ⎕R/⎕S (PCRE), ⎕SS (PCRE2), respectively
C++11 (C++)Licensed by the respective implementationSince ISO14822:2011(e), similar to ECMAScript on default
DBoost Software License
ElixirApache 2.0Standard library includes PCRE-based . 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.
ErlangApache 2.0Standard library includes PCRE-based . 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)LGPL with static linking exceptionFree Pascal 2.6+ ships with TRegExpr from Sorokin and two other regular expression libraries; See .
Go
HaskellBSD3Omitted in the language report, and in GHC's Hierarchical Libraries
JavaGNU General Public LicenseREs are written as strings in source code: all backslashes must be doubled, harming readability.
JavaScript (ECMAScript)BSD3First-class citizens of the language with a special /.../mod syntax. Historically feature-limited, but improved since ES2018. Two major regex engines: V8's Irregexp (used in Chrome and Blink-based browsers, as well as Firefox, Node.js) and JavaScriptCore's YARR (in Safari and WebKit-based browsers).
JuliaMIT LicenseREs are part of the language core library using PCRE built-in and an optional wrapper for (C code) ICU is available.
LuaMIT LicenseUses simplified, limited dialect; can be bound to more powerful library, like PCRE or an alternative parser like LPeg.
MathematicaProprietary
.NETMIT License
NimMIT LicenseStandard library includes PCRE-based and modules, as well as various alternatives (ex. , (Parsing Expression Grammar matching), , , etc.).
OCamlLGPLAs of 2010[update], the standard module is generally regarded as deprecated; often recommended libraries are (with full support for PCRE) and (which is not as complete but claims better performance and provides frontends to popular syntaxes: PCRE, Perl, Posix, Emacs, shell globbing).
PerlArtistic License, or GNU General Public LicenseFull, central part of the language
PHPPHP LicenseHas two implementations, with PCRE being the more efficient in speed, functions
POSIX C (C)Licensed by the respective implementationSupports syntax
PythonPython Software Foundation LicensePython has two major implementations, the built in and the library.
RubyGNU Library General Public LicenseRuby 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.
RustMIT LicenseThe primary regex crate does not allow look-around expressions. There is an Oniguruma binding called that does.
SAP ABAPProprietary
Tcl(BSD-style)Tcl library doubles as a regular expression library.
Wolfram LanguageProprietary: usable for free on a limited scale on the Wolfram Development platform
XML SchemaLicensed by the respective implementation
XPath 3/XQueryLicensed by the respective implementation

Language features

NOTE: An application using a library for regular expression support does not necessarily support the full set of features of the library, e.g., GNU grep uses PCRE, but supports no lookahead, though PCRE does.

Part 1

Language feature comparison (part 1)
"+" quantifierNegated character classesNon-greedy quantifiersShy groupsRecursionLook-aheadLook-behindBackreferences>9 indexable captures
Boost.RegexYesYesYesYesYesYesYesYesYes
Boost.XpressiveYesYesYesYesYesYesYesYesYes
CL-PPCREYesYesYesYesNoYesYesYesYes
EmEditorYesYesYesYesNoYesYesYesNo
NoNoSomeYesNoNoNoYesYes
GLib/GRegexYesYesYesYesYesYesYesYesYes
GNU grepYesYesYesYesNoYesYesYes—N/a
HaskellYesYesYesYesNoYesYesYesYes
YesYesYesYesNoNoNoYesYes
ICU RegexYesYesYesYesNoYesYesYesYes
JavaYesYesYesYesNoYesYesYesYes
JavaScript (ECMAScript)YesYesYesYesNoYesYesYesYes
JGsoftYesYesYesYesYesYesYesYesYes
LuaYesYesSomeNoNoNoNoYesNo
.NETYesYesYesYesNoYesYesYesYes
OCamlYesYesNoNoNoNoNoYesNo
PCREYesYesYesYesYesYesYesYesYes
PerlYesYesYesYesYesYesYesYesYes
PHPYesYesYesYesYesYesYesYesYes
PythonYesYesYesYesYesYesYesYesYes
Qt/QRegExpYesYesYesYesNoYesNoYesYes
RE2YesYesYesYesNoNoNoNoYes
Ruby, OnigmoYesYesYesYesYesYesYesYesYes
TREYesYesYesYesNoNoNoYesNo
VimYesYesYesYesNoYesYesYesNo
RGXYesYesYesYesNoYesYesYesYes
TclYesYesYesYesNoYesYesYesYes
TRegExprYes?Yes??????
XML SchemaYesYesNo—N/aNoNoNoNo—N/a
XPath 3/XQueryYesYesYesYesNoNoNoYesYes
YesYesYesYesNoYesYesYesYes

Part 2

Language feature comparison (part 2)
DirectivesConditionalsAtomic groupsNamed captureCommentsEmbedded codeUnicode property supportBalancing groupsVariable-length look-behinds
Boost.RegexYesYesYesYesYesNoSomeNoNo
Boost.XpressiveYesNoYesYesYesNoNoNoNo
CL-PPCREYesYesYesYesYesYesSomeNoNo
EmEditorYesYes??YesNo?NoNo
NoNoYesYesYesNo?NoNo
GLib/GRegexYesYesYesYesYesNoSomeNoNo
GNU grepYesYes?YesYesNoNoNoNo
Haskell?????NoNoNoNo
YesYesNoYesYesNoNoNoNo
ICU RegexYesNoYesYesYesNoYesNoNo
JavaYesNoYesYesYesNoSomeNoNo
JavaScript (ECMAScript)NoNoNoYesNoNoSomeNoYes
JGsoftYesYesYesYesYesNoSomeNoYes
LuaNoNoNoNoNoNoNoNoNo
.NETYesYesYesYesYesNoSomeYesYes
OCamlNoNoNoNoNoNoNoNoNo
PCREYesYesYesYesYesYesYesNoNo
PerlYesYesYesYesYesYesYesNoNo
PHPYesYesYesYesYesNoNoNoNo
PythonYesYesYesYesYesNoYesNoYes
Qt/QRegExpNoNoNoNoNoNoNoNoNo
RE2YesNo?YesNoNoSomeNoNo
Ruby, OnigmoYesYesYesYesYesNoSomeNoNo
TclYesNoYesNoYesNoYesNoNo
TREYesNoNoNoYesNo?NoNo
VimYesNoYesNoNoNoNoNoYes
RGXYesYesYesYesYesNoYesNoNo
XML SchemaNoNoNoNoNoNoYesNoNo
XPath 3/XQueryNoNoNoNoNoNoYesNoNo
Leading onlyNoNoYesYesNoYesNoYes

API features

API feature comparison
Native UTF-16 supportNative UTF-8 supportMulti-line matchingPartial match
Boost.RegexNoNoYesYes
GLib/GRegexYesYesYesYes
YesYesNoYes
ICU RegexYesNoYes?
JavaYesYesYesYes
.NETNoYesYes?
PCREYesYesYesYes
Qt/QRegExpYesNoNoYes
Qt/QRegularExpressionYesYesYesYes
TclYesYesYes?
TREYesYesYes?
RGXNoNoYes?
wxWidgets::YesYesYes?
YesYesYesNo

See also

External links

  • – Detailed comparison of the most popular regular expression flavors
  • – with support for Java, JavaScript, .Net, PHP, Python and Ruby
  • – series of articles by Russ Cox, author of RE2