in reply to Explanation for Reg Expr

I have to say that trying to understand the relevant parts of perlre can feel like doing a structural analysis of the propositions of Wittgenstein, but I'll give it a try:-

I would say that the behaviour has to be explained by a combination of three provisions of this documentation:

1) "/g"match globally

2) "?="(update: "lookahead and ..." ) match best (see #3 below) and chain global matches

3) "match best""the earliest match is always the best."

More update: oops that's four provisions, er, amongst our provisions are, er, "I'll come in again"

-M

Free your mind

Replies are listed 'Best First'.
Re^2: Explanation for Reg Expr
by mdunnbass (Monk) on Mar 01, 2007 at 18:45 UTC
    I have to say that trying to understand the relevant parts of perlre can feel like doing a structural analysis of the propositions of Wittgenstein, but I'll give it a try:-

    Wait, you mean it wasn't just me? =) Glad to know other ppl have trouble wading through that page as well.

    Matt

      It says so right on the page. http://perldoc.perl.org/perlre.html#BUGS:

      This document varies from difficult to understand to completely and utterly opaque. The wandering prose riddled with jargon is hard to fathom in several places.

      This document needs a rewrite that separates the tutorial content from the reference content.

        Heh, looks like there is a job for you right there then ysth. Rewrite the regex documentation. ;)


        DWIM is Perl's answer to Gödel