Comparison of regular expression engines

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Template:Short description

This is a comparison of regular expression engines.

Libraries

List of regular expression libraries
Name Official website Programming language Software license Used by
Template:Rh | Boost.RegexTemplate:R Boost C++ Libraries C++ Boost Notepad++ >= 6.0.0, EmEditor
Template:Rh | BoostTemplate:Not a typoXpressive Boost C++ Libraries C++ Boost  
Template:Rh | DEELX RegExLab C++ Proprietary  
Template:Rh | FREJTemplate:R Fuzzy Regular Expressions for Java Java LGPL  
Template:Rh | GLib/GRegexTemplate:R GLib reference manual C LGPL  
Template:Rh | GNU regex Gnulib reference manual C LGPL GNU libc, GNU programs
Template:Rh | GRETA Microsoft Research C++ Proprietary  
Template:Rh |Gregex Grovf Inc. RTL, HLS Proprietary FPGA accelerated >100 Gbit/s regex engine for cybersecurity, financial, e-commerce industries.
Template:Rh | Hyperscan Intel C, x86-specific assembly (SSSE3+[1]) 3-clause BSD Rspamd
Template:Rh | ICU International Components for Unicode C, C++Template:R ICU Foundation (Apple and Swift open-source versions)
Template:Rh | Jakarta Regexp The Apache Jakarta Project Java Apache  
Template:Rh | java.util.regex Java's User manual Java GNU GPLv2 with Classpath exception jEdit
Template:Rh | JRegex JRegex Java BSD  
Template:Rh | MATLAB Regular Expressions MATLAB Language Proprietary  
Template:Rh | Oniguruma Kosako C BSD Atom, Take Command Console, Tera Term, TextMate, Sublime Text, SubEthaEdit, EmEditor, jq, Ruby
Template:Rh | Pattwo Stevesoft Java (compatible with Java 1.0) LGPL  
Template:Rh | PCRE pcre.org C, C++Template:R BSD Apache HTTP Server, Nginx, BBEdit, Edbrowse, Julia, HHVM, Notepad++ < 6.0.0, PHP, Delphi, R, Exim, SWI-Prolog, Elixir, Erlang
Template:Rh | Qt/QRegExp Digia Template:Webarchive C++ Qt GNU GPL v. 3.0,

Qt GNU LGPL v. 2.1, Qt Commercial

Kate, Kile
Template:Rh | regex - Henry Spencer's regular expression libraries ArgList C BSD  
Template:Rh | RE2 RE2 C++ BSD Go, Google Sheets, Gmail, G Suite
Template:Rh | Henry Spencer's Advanced Regular Expressions Tcl C BSD  
Template:Rh | RGX RGX C++ based component library P6R  
Template:Rh | RXP Titan IC RTL Proprietary hardware-accelerated search acceleration using RegEx available for ASIC, FPGA and cloud. Enables massively parallel content processing at ultra-high speeds.
Template:Rh | SubReg Matt Bucknall C MIT  
Template:Rh | TPerlRegEx TPerlRegEx VCL Component Object Pascal MPLv1.1  
Template:Rh | TRETemplate:R Ville Laurikari C BSD musl
Template:Rh | TRegExpr TRegExpr, documentation,

(RegExp Studio)

Object Pascal Dual-license: freeware, or LGPL with static linking exception Total Commander
Template:Rh | Wolfram Language (Mathematica) Wolfram Language Documentation Center Wolfram Language Proprietary Mathematica, the Wolfram Development Platform
Template:Rh | XRegExp XRegExp JavaScript MIT  

<templatestyles src="Reflist/styles.css" />

Cite error: <ref> tag with name "boost_regex_formerly_regex" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "glib_gregex_version" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "pcre_cpp" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "fuzzy_regexp_libraries" defined in <references> is not used in prior text.

Cite error: <ref> tag with name "icu4j" defined in <references> is not used in prior text.

Script error: No such module "Check for unknown parameters".

Languages

List of languages and frameworks including regular expression support
Language Official website Software license Remarks
Template:Rh | ActionScript 3 ActionScript Technology Center Free
Template:Rh | APL (APLX, Dyalog, GNU) APL Wiki Licensed by the respective implementation ⎕SS (PCRE), ⎕R/⎕S (PCRE), ⎕SS (PCRE2), respectively
Template:Rh | C++11 (C++) C++ standards website Licensed by the respective implementation Since ISO14822:2011(e), similar to ECMAScript on default (Grammar Description)
Template:Rh | D D Boost Software LicenseTemplate:R
Template:Rh | Elixir elixir-lang.org Apache 2.0 Standard 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.
Template:Rh | Erlang erlang.org Apache 2.0 Standard 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.
Template:Rh | 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; See wiki.lazarus.freepascal.org/Regexpr.
Template:Rh | Go go.dev BSD-style
Template:Rh | Haskell Haskell.org BSD3 Omitted in the language report, and in GHC's Hierarchical Libraries
Template:Rh | Java Java GNU General Public License REs are written as strings in source code: all backslashes must be doubled, harming readability.
Template:Rh | JavaScript (ECMAScript) ECMA-262 BSD3 Limited but REs are first-class citizens of the language with a specific /.../mod syntax.
Template:Rh | 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.
Template:Rh | Lua Lua.org MIT License Uses simplified, limited dialect; can be bound to more powerful library, like PCRE or an alternative parser like LPeg.
Template:Rh | Mathematica Wolfram Proprietary
Template:Rh | .NET MSDN MIT LicenseTemplate:RTemplate:R
Template:Rh | Nim nim-lang.org MIT License Standard library includes PCRE-based re and nre modules, as well as various alternatives (ex. strutils, pegs (Parsing Expression Grammar matching), strscans, parseutils, etc.).
Template:Rh | OCaml Caml LGPL since 2010Template:Dated maintenance category (articles)Script error: No such module "Check for unknown parameters"., 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).
Template:Rh | Perl Perl.com Artistic License, or GNU General Public License Full, central part of the language
Template:Rh | PHP PHP.net PHP License Has two implementations, with PCRE being the more efficient in speed, functions
Template:Rh | POSIX C (C) POSIX.1 web publication Licensed by the respective implementation Supports POSIX BRE and ERE syntax
Template:Rh | Python python.org Python Software Foundation License Python has two major implementations, the built in re and the regex library.
Template:Rh | 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.
Template:Rh | Rust docs.rs MIT License The primary regex crate does not allow look-around expressions. There is an Oniguruma binding called onig that does.
Template:Rh | SAP ABAP SAP.com Proprietary
Template:Rh | Tcl tcl.tk Tcl/Tk License
(BSD-style)
Tcl library doubles as a regular expression library.
Template:Rh | Wolfram Language Wolfram Research Proprietary: usable for free on a limited scale on the Wolfram Development platform
Template:Rh | XML Schema W3C Licensed by the respective implementation
Template:Rh | XPath 3/XQuery W3C Licensed by the respective implementation

<templatestyles src="Reflist/styles.css" />

Cite error: <ref> tag with name "boost_mars" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "dotnet_regex_license" defined in <references> is not used in prior text.

Cite error: <ref> tag with name "dotnet_license" defined in <references> is not used in prior text.

Script error: No such module "Check for unknown parameters".

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)
"+" quantifier Negated character classes Non-greedy quantifiers
Template:R
Shy groups
Template:R
Recursion Look-ahead Look-behind Backreferences
Template:R
>9 indexable captures
Template:Rh | Boost.Regex Yes Yes Yes Yes YesTemplate:R Yes Yes Yes Yes
Template:Rh | Boost.Xpressive Yes Yes Yes Yes YesTemplate:R Yes Yes Yes Yes
Template:Rh | CL-PPCRE Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh | EmEditor Yes Yes Yes Yes No Yes Yes Yes No
Template:Rh | FREJ NoTemplate:R No SomeTemplate:R Yes No No No Yes Yes
Template:Rh | GLib/GRegex Yes Yes Yes Yes Yes Yes Yes Yes Yes
Template:Rh | GNU grep Yes Yes Yes Yes No Yes Yes Yes
Template:Rh | Haskell Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh |RXP Yes Yes Yes Yes No No No Yes Yes
Template:Rh | ICU Regex Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh | Java Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh | JavaScript (ECMAScript) Yes Yes Yes Yes No Yes YesTemplate:R Yes Yes
Template:Rh | JGsoft Yes Yes Yes Yes Yes[3] Yes Yes Yes Yes
Template:Rh | Lua Yes Yes SomeTemplate:R No No No No Yes No
Template:Rh | .NET Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh | OCaml Yes Yes No No No No No Yes No
Template:Rh | PCRE Yes Yes Yes Yes Yes Yes Yes Yes Yes
Template:Rh | Perl Yes Yes Yes Yes Yes Yes Yes Yes Yes
Template:Rh | PHP Yes Yes Yes Yes Yes Yes Yes Yes Yes
Template:Rh | Python Yes Yes Yes Yes YesTemplate:R Yes Yes Yes Yes
Template:Rh | Qt/QRegExp Yes Yes Yes Yes No Yes No Yes Yes
Template:Rh | RE2 Yes Yes Yes Yes No No No No Yes
Template:Rh | Ruby, Onigmo Yes Yes Yes Yes Yes Yes Yes Yes Yes
Template:Rh | TRE Yes Yes Yes Yes No No No Yes No
Template:Rh | Vim Yes Yes Yes Yes No Yes Yes Yes No
Template:Rh | RGX Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh | Tcl Yes Yes Yes Yes No Yes Yes Yes Yes
Template:Rh | TRegExpr Yes ? Yes ? ? ? ? ? ?
Template:Rh | XML Schema Yes Yes No No No No No
Template:Rh | XPath 3/XQuery Yes Yes Yes Yes No No No Yes Yes
Template:Rh | XRegExp Yes Yes Yes Yes No Yes YesTemplate:R Yes Yes

<templatestyles src="Reflist/styles.css" />

Cite error: <ref> tag with name "non_greedy" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "shy" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "backref" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "xpressive_recursion" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "boost_regex_recursion" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "frej_non_greedy" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "lua_non_greedy" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "python_regex_only2" defined in <references> is not used in prior text.

Cite error: <ref> tag with name "js_lookbehind_es2018" defined in <references> is not used in prior text.

Script error: No such module "Check for unknown parameters".

Part 2

Language feature comparison (part 2)
Directives
Template:R
Conditionals Atomic groups
Template:R
Named capture
Template:R
Comments Embedded code Unicode property support [4] Balancing groups
Template:R
Variable-length look-behinds
Template:R
Template:Rh | Boost.Regex Yes Yes Yes Yes Yes No SomeTemplate:R No No
Template:Rh | Boost.Xpressive Yes No Yes Yes Yes No No No No
Template:Rh | CL-PPCRE Yes Yes Yes Yes Yes Yes SomeTemplate:R No No
Template:Rh | EmEditor Yes Yes ? ? Yes No ? No No
Template:Rh | FREJ No No Yes Yes Yes No ? No No
Template:Rh | GLib/GRegex Yes Yes Yes Yes Yes No SomeTemplate:R No No
Template:Rh | GNU grep Yes Yes ? Yes Yes No No No No
Template:Rh | Haskell ? ? ? ? ? No No No No
Template:Rh |RXP Yes Yes No Yes Yes No No No No
Template:Rh | ICU Regex Yes No Yes YesTemplate:R Yes No Yes No No
Template:Rh | Java Yes No Yes YesTemplate:R Yes No SomeTemplate:R No No
Template:Rh | JavaScript (ECMAScript) No No No Yes No No SomeTemplate:R[Note 1][5] No Yes
Template:Rh | JGsoft Yes Yes Yes Yes Yes No SomeTemplate:R No Yes
Template:Rh | Lua No No No No No No No No No
Template:Rh | .NET Yes Yes Yes Yes Yes No SomeTemplate:R Yes Yes
Template:Rh | OCaml No No No No No No No No No
Template:Rh | PCRE Yes Yes Yes Yes Yes Yes Yes No No
Template:Rh | Perl Yes Yes Yes Yes Yes Yes Yes No NoTemplate:R
Template:Rh | PHP Yes Yes Yes Yes Yes No No No No
Template:Rh | Python Yes Yes YesTemplate:R Yes Yes No YesTemplate:R No YesTemplate:R
Template:Rh | Qt/QRegExp No No No No No No No No No
Template:Rh | RE2 Yes No ? Yes No No SomeTemplate:R No No
Template:Rh | Ruby, Onigmo Yes Yes Yes Yes Yes No SomeTemplate:R No No
Template:Rh | Tcl Yes No Yes No Yes No Yes No No
Template:Rh | TRE Yes No No No Yes No ? No No
Template:Rh | Vim Yes No Yes No No No No No Yes
Template:Rh | RGX Yes Yes Yes Yes Yes No Yes No No
Template:Rh | XML Schema No No No No No No Yes No No
Template:Rh | XPath 3/XQuery No No No No No No Yes No No
Template:Rh | XRegExp Leading only No No Yes Yes No Yes No Yes

<templatestyles src="Reflist/styles.css" />

  1. The support and range of properties is dependent on implementation.

Cite error: <ref> tag with name "directives_explanation" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "atomic_grouping_explanation" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "named_groups_explanation" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "available_java_7" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "available_icu_55" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "properties_limited" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "balancing_groups_explanation" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "varlength_lookbehind_explanation" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "perl5_varlength_lookbehind" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "python_regex_only2" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "python_11_and_regex_only" defined in <references> is not used in prior text.

Cite error: <ref> tag with name "python3_regex_only" defined in <references> is not used in prior text.

Script error: No such module "Check for unknown parameters".

API features

API feature comparison
Native UTF-16 supportTemplate:R Native UTF-8 supportTemplate:R Multi-line matching Partial matchTemplate:R
Template:Rh | Boost.Regex No No Yes Yes
Template:Rh | GLib/GRegex Yes Yes Yes Yes
Template:Rh | RXP Yes Yes No Yes
Template:Rh | ICU Regex Yes No Yes ?
Template:Rh | Java YesTemplate:R YesTemplate:R Yes Yes
Template:Rh | .NET NoTemplate:R Yes Yes ?
Template:Rh | PCRE YesTemplate:R Yes Yes Yes
Template:Rh | Qt/QRegExp Yes No No YesTemplate:R
Template:Rh | Qt/QRegularExpression Yes Yes Yes Yes
Template:Rh | Tcl Yes YesTemplate:R Yes ?
Template:Rh | TRE Yes Yes Yes ?
Template:Rh | RGX No No Yes ?
Template:Rh | wxWidgets::wxRegExTemplate:R Yes Yes Yes ?
Template:Rh | XRegExp Yes Yes Yes No

<templatestyles src="Reflist/styles.css" />

Cite error: <ref> tag with name "UCS2" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "unicode_native" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "Java_Unicode" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "8.30" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "partial" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "Conversion" defined in <references> is not used in prior text.
Cite error: <ref> tag with name "partial_match_explanation" defined in <references> is not used in prior text.

Cite error: <ref> tag with name "wxRegEx" defined in <references> is not used in prior text.

Script error: No such module "Check for unknown parameters".

See also

References

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

External links

Template:Strings