in reply to Any way to use "POSIX Extended Regular Expressions"?

Since version 5.10 perl supports pluggable regex engines, and there's re::engine::PCRE on CPAN that should pretty much do what you want.
  • Comment on Re: Any way to use "POSIX Extended Regular Expressions"?

Replies are listed 'Best First'.
Re^2: Any way to use "POSIX Extended Regular Expressions"?
by ambrus (Abbot) on May 21, 2010 at 13:21 UTC

    You must mean re::engine::POSIX or re::engine::TRE. These modules, which give you posix regular expressions got pulled from CPAN, but you can still find them on backpan. They interpret the /x re option as the regex being an extended re.

      In perldoc POSIX::Regex, jettero writes:
      Yes, I'm aware there's special support for alternate regular expression systems in perl 5.10.x ... let me know when people are done with perl 5.6 and 5.8 and I'll delete this from CPAN. Thanks.

      I'm assuming that is a reference to re::engine::.* packages on CPAN that got pulled. But I've never heard of backpan before this.

      I would like to move forward in a way least likely to cause problems in the future. re::engine::.* seems to provide the cleanest syntax, but until I know better I prefer CPAN to "backpan" packages.

      I don't know why they got pulled from CPAN. Does anyone why that happened? Which would you use: POSIX::Regex from CPAN or re::engine::POSIX from backpan?

        I've no idea why it's pulled, you'd have to ask Avar if you wanted to know. I don't know POSIX::Regex so I can't advice on that.

Re^2: Any way to use "POSIX Extended Regular Expressions"?
by JavaFan (Canon) on May 21, 2010 at 12:29 UTC
    PCRE stands for "Perl Compatible Regular Expressions". Which used to implement a superset of Perl regular expression, but we have since (5.10) caught up.

    But the OP asked for POSIX regular expressions. Which, except for syntax differences, actually behave differently:

    "abc" =~ /.|../ && print $&;
    Prints 'a' with Perl, but a POSIX style regexp engine would result in 'ab' being printed. With POSIX style, "longest" trumps "leftmost".
Re^2: Any way to use "POSIX Extended Regular Expressions"?
by Lightknight (Beadle) on May 21, 2010 at 10:49 UTC
    Thanks for your reply, but as I said in my original post: "MySQL doesn't use Perl compatible regular expressions"