in reply to Re^2: Why aren't perl regular expressions really regular expressions?
in thread Why aren't perl regular expressions really regular expressions?

I.o.W the syntax looks compatible but the results may not in edge cases.

Exactly. The basic features are probably in place - I say "probably", as I've not actually looked at the pcre library -, but not all of the advanced features will be. At the very least I would expect that match-time code evaluation isn't; if you have a regular expression using that in a Perl program, I'd bet you will not be able to copy it unmodified to a script written in another language and having it Just Work™.

It's not gonna matter most of the time (famous last words, those), but one should still keep in mind that "Perl-compatible regular expressions" are really "almost-but-not-quite-Perl-compatible regular expressions".

(The fact that different languages all using the pcre library are gonna have compatible regular expressions among each other is added irony.)

  • Comment on Re^3: Why aren't perl regular expressions really regular expressions?

Replies are listed 'Best First'.
Re^4: Why aren't perl regular expressions really regular expressions?
by LanX (Saint) on Mar 17, 2015 at 20:35 UTC
    Hm ... what I meant is even with same syntax, i.e. no compilation error, you might get different results.

    IIRC there are differences in backtracking with nested groups and the notion of what an atomar match is (no guaranty PCRE not really my domain)

    JS claims to copy the Perl 4 standard, but even in this limited case you'll be confronted with incompatibilities.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    PS: Je suis Charlie!

Re^4: Why aren't perl regular expressions really regular expressions?
by Dumu (Monk) on Mar 18, 2015 at 10:32 UTC
    It's worth bearing in mind how far away from Perl's regex power other languages borrowing PCRE are, for evangelism purposes. Not only is the Perl syntax for running regexen without equal in its simplicity; the true Perl regex language and toolbox itself is beyond compare with other languages, and not (of course! - though as I had previously thought) a sort of removable engine that has been taken out and bolted more clumsily into other languages.

    Regexen were one of the ma(in|ny) reasons why I decided to become a Perl programmer, after I found out about them in Learning Perl.

    I wonder if the Perl 6 regex engine will be any easier to borrow?