This is a comparison of regular expression engines.

Libraries

List of regular expression libraries
NameOfficial websiteProgramming languageSoftware licenseUsed by
Boost.Regex[Note 1]Boost C++ LibrariesC++Notepad++ >= 6.0.0, EmEditor
BoostXpressiveBoost C++ LibrariesC++ 
DEELXRegExLabC++ 
FREJ[Note 2]Fuzzy Regular Expressions for JavaJava 
GLib/GRegex[Note 3]GLib reference manualC 
GNU regexGnulib reference manualCGNU libc, GNU programs
GRETAMicrosoft ResearchC++ 
GregexGrovf Inc.RTL, HLSFPGA accelerated >100 Gbit/s regex engine for cybersecurity, financial, e-commerce industries.
HyperscanIntelC, x86-specific assembly (SSSE3+[1])Rspamd
ICUInternational Components for UnicodeC, C++[Note 4]Foundation (Apple and Swift open-source versions)
IrregexpIrregexpC++Chrome, Firefox, Node.js
Jakarta RegexpThe Apache Jakarta ProjectJava 
java.util.regexJava's User manualJavajEdit
JRegexJRegexJava 
MATLABRegular ExpressionsMATLAB Language 
OnigurumaKosakoCAtom, Take Command Console, Tera Term, TextMate, Sublime Text, SubEthaEdit, EmEditor, jq, Ruby
Java port of OnigurumajoniJavaJRuby, Nashorn (JavaScript engine)
PattwoStevesoftJava (compatible with Java 1.0) 
PCREpcre.orgC, C++[Note 5]Apache HTTP Server, Nginx, BBEdit, Edbrowse, Julia, HHVM, Notepad++ < 6.0.0, PHP, Delphi, R, Exim, SWI-Prolog, Elixir, Erlang
Qt/QRegExpDigia Archived 2013-12-12 at the Wayback MachineC++Kate, Kile
regex - Henry Spencer's regular expression librariesArgListC 
RE2RE2C++Go, Google Sheets, Gmail, G Suite
Regex+slevithan/regex on GitHubJavaScript
Henry Spencer's Advanced Regular ExpressionsTclC 
RGXRGXC++ based component library 
RXPTitan ICRTLhardware-accelerated search acceleration using RegEx available for ASIC, FPGA and cloud. Enables massively parallel content processing at ultra-high speeds.
SubRegMatt BucknallC 
TPerlRegExTPerlRegEx VCL ComponentObject Pascal 
TRE[Note 2]Ville LaurikariCmusl
TRegexTRegexJavaGraalVM
TRegExprTRegExpr, documentation, (RegExp Studio)Object PascalTotal Commander
Wolfram Language (Mathematica)Wolfram Language Documentation CenterWolfram LanguageMathematica, the Wolfram Development Platform
XRegExpXRegExpJavaScript 
YARRYARRC++Safari, WebKit-based browsers, QML
  1. ^ boost_regex_formerly_regex
  2. ^ fuzzy_regexp_libraries
  3. ^ glib_gregex_version
  4. ^ icu4j
  5. ^ pcre_cpp
  6. ^ non_greedy
  7. ^ shy
  8. ^ backref
  9. ^ boost_regex_recursion
  10. ^ xpressive_recursion
  11. ^ frej_non_greedy
  12. ^ js_lookbehind_es2018
  13. ^ lua_non_greedy
  14. ^ python_regex_only2
  15. ^ var-length-via-es2018
  16. ^ directives_explanation
  17. ^ atomic_grouping_explanation
  18. ^ named_groups_explanation
  19. ^ balancing_groups_explanation
  20. ^ varlength_lookbehind_explanation
  21. ^ properties_limited
  22. ^ available_icu_55
  23. ^ available_java_7
  24. ^ The support and range of properties is dependent on implementation.
  25. ^ perl5_varlength_lookbehind
  26. ^ python_11_and_regex_only
  27. ^ python3_regex_only
  28. ^ regexplus-ims-style
  29. ^ regexplus-transpiled-to-native
  30. ^ regexplus-es2018-name-syntax
  31. ^ regexplus-x-flag
  32. ^ regexplus-v-flag
  33. ^ regexplus-v8-es2018-engine
  34. ^ unicode_native
  35. ^ partial_match_explanation
  36. ^ Java_Unicode
  37. ^ UCS2
  38. ^ 8.30
  39. ^ partial
  40. ^ Conversion
  41. ^ wxRegEx

Languages

List of languages and frameworks including regular expression support
LanguageOfficial websiteSoftware licenseRemarks
ActionScript 3ActionScript Technology Center
APL (APLX, Dyalog, GNU)APL Wiki
⎕SS

(PCRE),

⎕R

/

⎕S

(PCRE),

⎕SS

(PCRE2), respectively

C++11 (C++)C++ standards websiteSince ISO14822:2011(e), similar to ECMAScript on default (Grammar Description)
DD
Elixirelixir-lang.orgstyle="text-align: center;" {{free|Apache 2.0Standard library includes PCRE-based Regex 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.
Erlangerlang.orgstyle="text-align: center;" {{free|Apache 2.0Standard library includes PCRE-based re 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.orgFree Pascal 2.6+ ships with TRegExpr from Sorokin and two other regular expression libraries; See wiki.lazarus.freepascal.org/Regexpr.
Gogo.dev
HaskellHaskell.orgOmitted in the language report, and in GHC's Hierarchical Libraries
JavaJavaREs are written as strings in source code: all backslashes must be doubled, harming readability.
JavaScript (ECMAScript)ECMA-262First-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).
JuliaJuliaLang.orgREs are part of the language core library using PCRE built-in and an optional wrapper for (C code) ICU is available.
LuaLua.orgUses simplified, limited dialect; can be bound to more powerful library, like PCRE or an alternative parser like LPeg.
MathematicaWolfram
.NETMSDN
Nimnim-lang.orgStandard library includes PCRE-based re and nre modules, as well as various alternatives (ex. strutils, pegs (Parsing Expression Grammar matching), strscans, parseutils, etc.).
OCamlCamlAs of 2010, the standard module is generally regarded as deprecated;[2] often recommended libraries are pcre (with full support for PCRE) and re (which is not as complete but claims better performance and provides frontends to popular syntaxes: PCRE, Perl, Posix, Emacs, shell globbing).
PerlPerl.comFull, central part of the language
PHPPHP.netHas two implementations, with PCRE being the more efficient in speed, functions
POSIX C (C)POSIX.1 web publicationSupports POSIX BRE and ERE syntax
Pythonpython.orgPython has two major implementations, the built in re and the regex library.
Rubyruby-lang.orgRuby 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.
Rustdocs.rsThe primary regex crate does not allow look-around expressions. There is an Oniguruma binding called onig that does.
SAP ABAPSAP.com
Tcltcl.tkTcl library doubles as a regular expression library.
Wolfram LanguageWolfram Research
XML SchemaW3C
XPath 3/XQueryW3C

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 quantifiers
[Note 6]
Shy groups
[Note 7]
RecursionLook-aheadLook-behindBackreferences
[Note 8]
>9 indexable captures
Boost.Regex[Note 9]
Boost.Xpressive[Note 10]
CL-PPCRE
EmEditor
FREJ[Note 11][Note 11]
GLib/GRegex
GNU grep
Haskell
RXP
ICU Regex
Java
JavaScript (ECMAScript)[Note 12]
JGsoft[3]
Lua[Note 13]
.NET
OCaml
PCRE
Perl
PHP
Python[Note 14]
Qt/QRegExp
RE2
Regex+[Note 15]
Ruby, Onigmo
TRE
Vim
RGX
Tcl
TRegExpr
XML Schema
XPath 3/XQuery
XRegExp[Note 12]

Part 2

Language feature comparison (part 2)
Directives
[Note 16]
ConditionalsAtomic groups
[Note 17]
Named capture
[Note 18]
CommentsEmbedded codeUnicode property support [4]Balancing groups
[Note 19]
Variable-length look-behinds
[Note 20]
Boost.Regex[Note 21]
Boost.Xpressive
CL-PPCRE[Note 21]
EmEditor
FREJ
GLib/GRegex[Note 21]
GNU grep
Haskell
RXP
ICU Regex[Note 22]
Java[Note 23][Note 21]
JavaScript (ECMAScript)[Note 21][Note 24][5]
JGsoft[Note 21]
Lua
.NET[Note 21]
OCaml
PCRE
Perl[Note 25]
PHP
Python[Note 26][Note 27][Note 14]
Qt/QRegExp
RE2?[Note 21]
Regex+[Note 28][Note 29][Note 30][Note 31][Note 32][Note 33]
Ruby, Onigmo[Note 21]
Tcl
TRE
Vim
RGX
XML Schema
XPath 3/XQuery
XRegExpLeading only

API features

API feature comparison
Native UTF-16 support[Note 34]Native UTF-8 support[Note 34]Multi-line matchingPartial match[Note 35]
Boost.Regex
GLib/GRegex
RXP
ICU Regex
Java[Note 36][Note 36]
.NET[Note 37]
PCRE[Note 38]
Qt/QRegExp[Note 39]
Qt/QRegularExpression
Tcl[Note 40]
TRE
RGX
wxWidgets::wxRegEx[Note 41]
XRegExp

See also

References

  1. ^ "Getting Started – Hyperscan 5.4.0 documentation"
  2. ^ "Regex - Regular Expressions in OCaml"
  3. ^ "Recursive Regex—Tutorial"
  4. ^ "UTS #18: Unicode Regular Expressions"
  5. ^ "ECMA-262, 9th edition, June 2018 ECMAScript® 2018 Language Specification". www.ecma-international.org. Retrieved 4 August 2020.