所有正则表达式实现的列表? [英] List of all regex implementations?
问题描述
网络上是否有 Regex 实现的列表,显示它们的差异/相似之处?
Is there a list of Regex implementations on the web, showing their differences / similarities?
例如,Emacs elisp Regex 与 JavaScript 或 Perl regex 不同,更不用说不同编辑器软件使用的所有不同实现了,
For exaple, Emacs elisp Regex is different to JavaScript or Perl regex, not to mention all the different implementations used by different editor software,
例如VS2010 使用 {}
而不是 ()
将表达式分组以进行反向引用.
e.g. VS2010 uses {}
instead of ()
to group expressions for back references.
曾几何时,我可以依赖 O'Reilly 的 Regex Pocket Quick Reference 中的 Regex 转换列表,但网上的东西会更容易、更完整.
Once upon a time I could rely on a Regex conversion list in O'Reilly's Regex Pocket Quick Reference, but something online would be so much easier, and complete.
顺便说一句,我知道(当然)http://www.regular-expressions.info/ 这很好,但还远未完成.
By the way, I am aware of (of course) http://www.regular-expressions.info/ which is good, but no where near complete.
我将根据此处发布的答案以及我能找到的任何其他内容编制一个列表.
I'll compile a list from the answers posted here, and anything else I can find.
实现上的差异通常是特殊字符{}()[]^$
的处理方式(转义规则等),偶尔会被替换;POSIX 字符类的处理/可用性,例如[:digit:]
,以及选项的使用,例如g
i
等等
The differences in implementations are usually the way special characters {}()[]^$
are handled (escaping rules etc.), and occasionally substituted; the handling/availability of POSIX character classes e.g. [:digit:]
, and the use of options, e.g. g
i
etc.
(正在进行中,如果您知道任何警告,这些实现的差异,请将它们添加为答案)
(a work in progress, if you know any caveats, differences for these implementations please add them as an answer)
- ActionScript - 使用 ECMA 风格
- Delphi (.Net) - 使用 .Net 风格.Delphi Win32 没有本机正则表达式,但可以使用 PCRE 包装器.
- Emacs/ELisp - 有 2 个不同的上下文,转义使用 elisp 中的
\\
和regexp-replace
中的\
.特殊字符(){}[]
在用于正则表达式功能时会被转义,很像sed
. - Eclipse - 搜索使用 Java 风格的正则表达式.
- GNU (Linux) - POSIX BRE/ERE
- Grep - POSIX BRE/ERE
- Groovy - 使用 Java 风格.
- IntelliJ
- Java - Java 风格.
- JavaScript - 使用 ECMA 风格.
- NetBeans
- .NET - 使用 System.Text.RegularExpressions 中的类
- 记事本++ - PCRE
- PCRE (C/C++) - 开源库,被许多第三方语言和应用使用.(例如 PHP、TCL、R 等)
- Perl - Perl 风格
- PHP - POSIX ERE、PCRE,(PHP5 的多字节字符串模块使用 Oniguruma)
- POSIX - BRE(基本正则表达式)、ERE(扩展正则表达式)
- PowerShell - .Net 风格
- Python - Python 风格
- R - POSIX ERE/BRE、PCRE
- REALbasic - PCRE
- Ruby - Oniguruma
- Sed - 特殊字符
(){}[]
在将它们用于正则表达式功能时会被转义. - Tcl - 三种风格,Tcl ARE(高级正则表达式)、POSIX ERE、POSIX BRE.
- TextMate - Oniguruma
- Tera 术语 - Oniguruma
- VBScript - ECMA
- Visual Basic 6 - ECMA(使用 Microsoft VBScript 正则表达式 5.5 COM 对象时)
- Visual Studio - 分组括号是
{}
(更多详细信息,请关注.) - wxWidgets - Tcl ARE、POSIX BRE/ERE
- XML 架构 - XML
- XQuery &XPath - Xpath
- ActionScript - uses ECMA style
- Delphi (.Net) - Uses .Net style. Delphi Win32 has no native regex, but PCRE wrappers are available.
- Emacs/ELisp - has 2 different contexts, escaping uses
\\
in elisp, and\
inregexp-replace
. Special chars(){}[]
are escaped when using them for regex features, much likesed
. - Eclipse - Search uses Java style regex.
- GNU (Linux) - POSIX BRE / ERE
- Grep - POSIX BRE / ERE
- Groovy - Uses Java style.
- IntelliJ
- Java - Java style.
- JavaScript - uses ECMA style.
- NetBeans
- .NET - Uses the classes in System.Text.RegularExpressions
- Notepad++ - PCRE
- PCRE (C/C++) - Open source library, used by many third party languages and apps. (e.g. PHP, TCL, R etc.)
- Perl - Perl style
- PHP - POSIX ERE, PCRE, (PHP5's multibyte string module uses Oniguruma)
- POSIX - BRE (Basic Regex), ERE (Extended Regex)
- PowerShell - .Net style
- Python - Python style
- R - POSIX ERE/BRE, PCRE
- REALbasic - PCRE
- Ruby - Oniguruma
- Sed - special chars
(){}[]
are escaped when using them for regex features. - Tcl - Three flavors, Tcl ARE (advanced regex), POSIX ERE, POSIX BRE.
- TextMate - Oniguruma
- Tera Term - Oniguruma
- VBScript - ECMA
- Visual Basic 6 - ECMA (when using Microsoft VBScript Regular Expressions 5.5 COM object)
- Visual Studio - Grouping braces are
{}
(more details to follow.) - wxWidgets - Tcl ARE, POSIX BRE/ERE
- XML Schema - XML
- XQuery & XPath - Xpath
推荐答案
看看 RegularRegular-Expressions.info 上的表达风味比较.它至少包含了当今最重要的正则表达式实现及其特性.
Take a look at the Regular Expression Flavor Comparison on Regular-Expressions.info. It contains at least the nowadays most important regular expression implementations and their characteristics.
这篇关于所有正则表达式实现的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!