tags:

views:

56

answers:

4

Is there any regex standard ? Is PCRE supported by all regex engines ?

Thanks for replies

+2  A: 

Regular-Expressions.info has a nice feature comparison table. There you can see that the basic syntax components (character classes, grouping, quantifiers, alternation) are supported by almost all flavors/implementations.

Gumbo
+1  A: 

All languages that I know of use the same basic syntax for regex although there may be some small variations between lanauages. See http://www.regular-expressions.info/ for regex syntax.

starofale
+2  A: 

Not all language support the same regex syntax, most of them are based on PCRE or POSIX syntax but they can change it by adding or removing functionnalities.

You can see the main alternatives on the regular-expressions.info web site, Regular Expression Flavor Comparison.


Resources :

On the same topic :

Colin Hebert
+3  A: 

No. There are many regex syntaxes, all vaguely related, but with various differences that frequently require changes when moving a regex from one matching engine to another.

Perl/PCRE is one of the most common, but you'll also probably need to understand the differences in the grep, egrep and vi flavors, if you use any Unixy system. If your programming language of choice isn't Perl and its regex implementation isn't based on PCRE, it likely has additional quirks.

Warren Young