Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

programming languages - List of all regex implementations?

Is there a list of Regex implementations on the web, showing their differences / similarities?

For exaple, Emacs elisp Regex is different to JavaScript or Perl regex, not to mention all the different implementations used by different editor software,

e.g. VS2010 uses {} instead of () to group expressions for back references.

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.

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.

Variations

General Variations

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 - 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 in regexp-replace. Special chars (){}[] are escaped when using them for regex features, much like sed.
  • 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

Additional references.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...