develooper Front page | perl.perl5.porters | Postings from August 2000

Re: Proposal for \v and \V, the small- and large- cut regex operators.

From:
Jeffrey Friedl
Date:
August 9, 2000 03:40
Subject:
Re: Proposal for \v and \V, the small- and large- cut regex operators.
Message ID:
200008091040.DAA12214@ventrue.yahoo.com

Simon Cozens wrote:
|> Jeremy Zawodny wrote;
|> >Someone might try cloning perlre.pod and removing all the references
|> >to backtracking (there we around 15 or 20 I think) and replacing them
|> >with the "combining pieces" equivalent? Or maybe just a replacement
|> >for the ``Backtracking'' section...
|> 
|> What a good idea. Please note that perlreguts currently doesn't exist,
|> and that the section I've started hacking needs still more work.
|> 
|> --- perlre.pod~ Wed Aug  9 14:27:40 2000
|> +++ perlre.pod  Wed Aug  9 15:17:25 2000
|
| [the backtracking section ripped out]

Mmmm, I think this is still a bit premature. Before the section on
backtracking is ripped out, don't you think that it's important that
there's some section in there that describes completely how the user should
construct regular expressions, and how Perl will consider them?

Currently, the "Combining pieces together" section (renamed by Simon to "How
regexps fit together") doesn't give a clue as to why
    "aaaaaaa" =~ m/(a+)\1/'
matches what it does, much less something like:
    "abcdefgfedcba" =~ m/((?>[abc]+))*.*?\1/

Before ripping out these factually correct (albite deemed to be too
difficult to understand) sections, let's make the new section descriptive
enough to totally replace them. That means that it should allow someone
that's never seen regular expressions to, reading only this, to be able to
eventually understand why $1 will get the value it gets.

Part of Simon's patch continues:
|> [having to understand backtracking] also means you have to understand
|> the operation of the B<whole> regular expression, rather than just each
|> of its parts.

Exactly. That's the nature of the beast. It may not be desirable, but no
one's yet shown it to not be the case.

	Jeffrey
------------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@yahoo-inc.com> Yahoo! Finance http://finance.yahoo.com



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About