views:

147

answers:

5

Specifically, I'm using the Linux command:

$ find . -regextype posix-extended -regex '<some regex>' ...

I just want to make sure the POSIX type I'm using is the type Perl uses, since that is by far the one I am most familiar with.

+8  A: 

Perl's regular expression engine is Perl's regular expression engine. perl defines Perl.

For details, see perldoc perlreref.

Sinan Ünür
+5  A: 

Perl uses Perl regular expressions, not POSIX ones. You can compare the syntaxes yourself, for example in regex(7).

wRAR
+8  A: 

Perl has defined its own standard for regexes. E.g., there are systems such as PCRE, which stands for Perl Compatible Regular Expressions.

Paul Nathan
Or Perl-Compatible Regular Expression, right?
Cameron
+1, although note that PCRE isn't completely Perl-compatible.
Josh Kelley
*The name is misleading, because PCRE is Perl-compatible only if you consider a subset of PCRE's settings and a subset of Perl's regular expression facilities.* http://en.wikipedia.org/wiki/PCRE
Sinan Ünür
Paul Nathan
+1  A: 

Perl's regexes are more like the Posix extended ones. Basic posix regular expressions use ( and { to match the actual characters, and \( and \{ as special characters, but the Posix extended ones use ( and { for the same meaning as in Perl and \( or \{ to match the actual characters, the same as Perl. So posix-extended is what you want.

Kinopiko
+5  A: 

Per perldoc perlhist, Perl 0 ("Classified. Don't ask.") used basic regular expressions. All versions since, starting with Perl 1.000 in December of '87, have used extended regular expressions (and extended on those...).

ysth