Telekomunikasi Sains    
   
Daftar Isi
(Sebelumnya) Comparison of reference manage ...Comparison of relational datab ... (Berikutnya)

Perbandingan -- regular expression engines

This is a comparison of regular expression engines.

Contents

Libraries

Daftar/Tabel -- regular expression libraries
NameOfficial websiteProgramming languageSoftware license
Boost.Regex[Note 1]Boost C++ LibrariesC++Boost
Boost.XpressiveBoost C++ LibrariesC++Boost
CL-PPCREEdi WeitzCommon LispBSD
cppreJeff StuartC++GPL
DEELXRegExLabC++Free personal and commercial use
FREJ[Note 2]Fuzzy Regular Expressions for JavaJavaLGPL
GLib/GRegex[Note 3]Marco BarisioneCLGPL
GRETAMicrosoft ResearchC++?
ICUInternational Components for UnicodeC, C++ [Note 4]ICU
Jakarta/RegexpThe Apache Jakarta ProjectJavaApache
JRegexJRegexJavaBSD
OnigurumaKosakoCBSD
PattwoStevesoftJava (compatible with Java 1.0)LGPL
PCREPhilip HazelC, C++[Note 5]BSD
Qt/QRegExp[3]C++Qt GNU GPL v. 3.0, Qt GNU LGPL v. 2.1, Qt Commercial
regex - Henry Spencer's regular expression librariesArgListCBSD
re2Google CodeC++BSD
TRE [Note 2]Ville LaurikariCBSD
TPerlRegExTPerlRegEx VCL ComponentObject PascalMPLv1.1
TRegExprRegExp StudioObject PascalDual-license: freeware, or LGPL with static linking exception
RGXRGXC++ based component libraryP6R
XRegExpXRegExpJavaScriptMIT
  1. ^ formerly called Regex++
  2. ^ a b one of fuzzy regular expression engines
  3. ^ included since version 2.13.0
  4. ^ ICU4J, the Java version, does not support regular expressions
  5. ^ C++ bindings were developed by Google and became officially part of PCRE in 2006

Languages

Daftar/Tabel -- languages and frameworks including regular expression support
LanguageOfficial websiteSoftware licenseRemarks
.NETMSDNProprietary
C++0x (C++)??since ISO14822:2011(e)
DDBoost Software License[Note 1]
GoGolang.orgBSD-style
HaskellHaskell.orgBSD3Omitted in the language report, and in GHC's Hierarchical Libraries
JavaJavaGNU General Public LicenseREs are written as strings in source code: all backslashes must be doubled, harming readability
JavaScript (ECMAScript)ECMA-262BSD3Limited but REs are first-class citizens of the language with a specific /.../mod syntax
LuaLua.orgMIT LicenseUses simplified, limited dialect; can be bound to more powerful library, like PCRE or an alternative parser like LPeg
MathematicaWolframProprietary
Free Pascal (Object Pascal)www.freepascal.orgLGPL with static linking exceptionFree Pascal 2.6+ ships with TRegExpr from Sorokin and 2 other regular expression libraries; see http://wiki.lazarus.freepascal.org/Re gexpr
Cocoa (Objective-C)AppleProprietaryAs of 2012, available on only iOS 4+ and OS X 10.7+
OCamlCamlLGPL
PerlPerl.comArtistic License, or GNU General Public LicenseFull, central part of the language
PHPPHP.netPHP LicenseHas two implementations, with PCRE being the more efficient in speed, functions
Pythonpython.orgPython Software Foundation License
Rubyruby-doc.orgGNU Library General Public LicenseRuby 1.8 and 1.9 use different engines; 1.9 integrates Oniguruma
SAP ABAPSAP.comProprietary
Tcl 8.4tcl.tkTcl/Tk License
(BSD-style)

ActionScript 3ActionScript Technology CenterFree

Language features

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

Part 1

Language feature comparison (part 1)
"+" quantifierNegated character classesNon-greedy quantifiers[Note 1]Shy groups[Note 2]RecursionLookaheadLookbehindBackreferences[Note 3]>9 indexable captures
Boost.RegexYesYesYesYesYes [Note 4]YesYesYesYes
Boost.XpressiveYesYesYesYesYes [Note 5]YesYesYesYes
CL-PPCREYesYesYesYesNoYesYesYesYes
EmEditorYesYesYesYesNoYesYesYesNo
FREJNo [Note 6]NoSome [Note 6]YesNoNoNoYesYes
GLib/GRegexYes?Yes?No????
GNU GrepYesYesYesYesNoYesYesYes?
HaskellYesYesYesYesNoYesYesYesYes
ICU RegexYesYesYesYesNoYesYesYesYes
JavaYesYesYesYesNoYesYesYesYes
JavaScript (ECMAScript)YesYesYesYesNoYesNoYesYes
JGsoftYesYesYesYesNoYesYesYesYes
.NETYesYesYesYesNoYesYesYesYes
OCamlYesYesNoNoNoNoNoYesNo
OmniOutliner 3.6.2YesYesYesNoNoNoNo??
PCREYesYesYesYesYesYesYesYesYes
PerlYesYesYesYesYesYesYesYesYes
PHPYesYesYesYesYesYesYesYesYes
PythonYesYesYesYesNoYesYesYesYes
Qt/QRegExpYesYesYesYesNoYesNoYesYes
R [Note 7]YesYesYesYesNoYesYesYesYes
re2YesYesYesYesNoNoNoNoYes
RubyYesYesYesYesYesYesYesYesYes
TREYesYesYesYesNoNoNoYesNo
Vim Patch 7.3.874 (2012-12-06) [±]YesYesYesYesNoYesYesYesNo
RGXYesYesYesYesNoYesYesYesYes
TRegExprYes?Yes??????
XRegExpYesYesYesYesNoYesNoYesYes
  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
  2. ^ Shy groups, also called non-capturing groups cannot be referred to with backreferences; non-capturing groups are used to speed up matching where the groups content needs not be accessed later.
  3. ^ 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"
  4. ^ http://www.boost.org/doc/libs/1_47_0/ libs/regex/doc/html/boost_regex/synta x/perl_syntax.html#boost_regex.syntax .perl_syntax.recursive_expressions
  5. ^ http://www.boost.org/doc/libs/1_47_0/ doc/html/xpressive/user_s_guide.html# boost_xpressive.user_s_guide.grammars _and_nested_matches.embedding_a_regex _by_reference
  6. ^ a b FREJ have no repetitive quantifiers, but have "optional" element which behaves similar to simple "?" quantifier
  7. ^ Regular Expressions as used in R

Part 2

Language feature comparison (part 2)
Directives [Note 1]ConditionalsAtomic groups [Note 2]Named capture [Note 3]CommentsEmbedded codeUnicode property support [4]
Boost.RegexYesYesYesYesYesNoSome [Note 4]
Boost.XpressiveYesNoYesYesYesNoNo
CL-PPCREYesYesYesYesYesYesNo
EmEditorYesYes??YesNo?
FREJNoNoYesYesYesNo?
GLib/GRegexYesYesYesYesYesNoSome [Note 4]
GNU GrepYesYes?YesYesNoNo
Haskell?????NoNo
ICU RegexYesNoYesNoYesNoYes
JavaYesNoYesYes [Note 5]NoNoSome [Note 4]
JavaScript (ECMAScript)NoNoNoNoNoNoNo
JGsoftYesYesYesYesYesNoSome [Note 4]
.NETYesYesYesYesYesNoSome [Note 4]
OCamlNoNoNoNoNoNoNo
OmniOutliner 3.6.2????NoNo?
PCREYesYesYesYesYesYesYes
PerlYesYesYesYesYesYesYes
PHPYesYesYesYesYesNoNo
PythonYesYesNoYesYesNoNo
Qt/QRegExpNoNoNoNoNoNoNo
re2YesNo ?YesNoNoSome [Note 4]
RubyYesNoYesYesYesYesSome [Note 4]
TREYesNoNoNoYesNo?
VimYesNoYesNoNoNoNo
RGXYesYesYesYesYesNoYes
XRegExpLeading onlyNoNoYesYesNoYes
  1. ^ Also known as Flags modifiers or Option letters. Example pattern: "(?i:test)"
  2. ^ Also called Independent sub-expressions
  3. ^ Similar to back references but with names instead of indices
  4. ^ a b c d e f g 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.
  5. ^ Available as of JDK7.

API features

API feature comparison
Native UTF-16 support [Note 1]Native UTF-8 support [Note 1]Multi-line matching
Boost.RegexNoNoYes
GLib/GRegexYesYesYes
ICU RegexYesNoYes
JavaNoPartial [Note 2]Yes
.NETNo [Note 3]NoYes
PCREYes [Note 4]YesYes
Qt/QRegExpYesNoNo
TRENo?Yes
RGXNoNoYes
XRegExpYes?Yes
  1. ^ a b Means the format can be used internally without explicit conversion
  2. ^ Supports Unicode 4.0 standard from 2003; latest plans for JDK7 include Unicode 6.0 (2011) support [1]
  3. ^ 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). [2].
  4. ^ Since version 8.30

See also

External links

(Sebelumnya) Comparison of reference manage ...Comparison of relational datab ... (Berikutnya)