This is a comparison of regular expression engines.
Libraries
- ^ Formerly called Regex++.
- ^ a b One of fuzzy regular expression engines.
- ^ Included since version 2.13.0.
- ^ ICU4J, the Java version, does not support regular expressions.
- ^ C++ bindings were developed by Google and became officially part of PCRE in 2006.
Languages
- ^ "STD.regex - D Programming Language - Digital Mars".
- ^ "Dotnet/Corefx". GitHub. 16 February 2022.
- ^ "Dotnet/Corefx". GitHub. 16 February 2022.
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
- ^ Non-greedy quantifiers match as few characters as possible, instead of the default as many. Note that many older, pre-POSIX engines were non-greedy and didn't have greedy quantifiers at all.
- ^ Shy groups, also called non-capturing groups cannot be referred to with backreferences; non-capturing groups are used to speed up matching where the group's content does not need to be accessed later.
- ^ Backreferences enable referring to previously matched groups in later parts of the regex and/or replacement string (where applicable). For instance, ([ab]+)\1 matches "abab" but not "abaab".
- ^ "Perl Regular Expression Syntax - 1.47.0".
- ^ "User's Guide - 1.47.0".
- ^ a b FREJ have no repetitive quantifiers, but have "optional" element which behaves similar to simple "?" quantifier.
- ^ a b As of ES2018
- ^ Lua's only non-greedy quantifier is
-
, 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. - ^ Supported by the optional regex library only.
Part 2
- ^ Also known as flags modifiers, modes modifiers or option letters. Example pattern: "(?i:test)".
- ^ Also called independent sub-expressions.
- ^ Similar to back references, but with names instead of indices.
- ^ Special feature allowing to match balanced constructs without recursion.
- ^ Refers to the possibility of including quantifiers in look-behinds, thus making their length unpredictable.
- ^ a b c d e f g h i Unicode property support may be incomplete (products are continuously updated!). All will be incomplete when a new Unicode revision is released until they are updated to comply.
- ^ Available as of ICU55.
- ^ Available as of JDK7.
- ^ The support and range of properties is dependent on implementation.
- ^ Experimental support added in v5.29.9.
- ^ Supported by Python v3.11 and later, and the optional regex library only.
- ^ May only be available in the regex library when used with Python versions after 3.3.
- ^ Supported by the optional regex library only.
API features
- ^ a b Means the format can be used internally without explicit conversion.
- ^ Partial match of the whole regular expression. For example the pattern ".*END$" will match any string partially, but only strings ending with END fully.[1].
- ^ a b Supports Unicode 15.0 standard from 2023.[2].
- ^ Implementation uses original UCS-2 support/features, so it only recognizes 64K chars total (vs UTF-16's 1,112,064 characters). A Microsoft developer-representative answered a bug report on this as "will not fix" in 2010.[3].
- ^ Since version 8.30.
- ^ Partial matching is performed implicitly, requiring a separate call to matchedLength() if an exact match fails.
- ^ Tcl includes facilities to convert to and from UTF-8.
- ^ wxRegEx uses any system supplied POSIX library or if not available and for Unicode mode uses Henry Spencer's library.
See also
References
- ^ "Getting Started – Hyperscan 5.4.0 documentation".
- ^ "Regex - Regular Expressions in OCaml".
- ^ "Recursive Regex—Tutorial".
- ^ "UTS #18: Unicode Regular Expressions".
- ^ "ECMA-262, 9th edition, June 2018 ECMAScript® 2018 Language Specification". www.ecma-international.org. Retrieved 4 August 2020.
External links
- Regular Expression Flavor Comparison – Detailed comparison of the most popular regular expression flavors
- Regexp Syntax Summary
- Online Regular Expression Testing – with support for Java, JavaScript, .Net, PHP, Python and Ruby
- Implementing Regular Expressions – series of articles by Russ Cox, author of RE2
- Regular Expression Engines