tags:

views:

127

answers:

3

Is there a nice table or a cheatsheet on the web that compares the sytax of emacs regex and PCRE?

That I have to remember to escape grouping parenthesis and braces and other differences when I'm using emacs regex, it's all confusing, a syntax comparison table would be good for minimizing confusion.

A: 

The difference is only on (){}| characters isn't it?

S.Mark
Can you be a little more specific? I mean, are look-aheads permitted? Obviously escaping differences are in place and it would be good to describe those.
PP
Ah You are right, for functional difference, you really need comparison charts, I don't have anything right now, I just mentioned the syntax different.
S.Mark
They are different also in the star character.
RamyenHead
+1  A: 

I think you're looking for http://www.regular-expressions.info/refflavors.html

Emacs's regexes are "GNU ERE" in those tables.

Tim Pietzcker
A: 

I will collect syntax differences that I know here. This answer is community wiki, add more if anyone wishes. Always check the preview before adding more.

When to escape ( ) { } |

In Emacs regexp, (, ), {, }, | are literal and escaped ones (\(, \), \{, \}, \|) are meta.

In Perl-compatible regexp, (, ), {, }, | are meta, and escaped ones are literal.

* and +

\* is the literal star in both Emacs and Perl. If an expression starts with a star, the starting star is literal in Emacs regexp, illegal in Perl regexp.

Similarly for the plus.

RamyenHead