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

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

From:
sthoenna
Date:
August 7, 2000 12:45
Subject:
Re: Proposal for \v and \V, the small- and large- cut regex operators.
Message ID:
zCxj5gzkg+CA092yn@efn.org
Maybe I'm just not getting it.  I'll look over some of Jeffery's
posted examples and see if light dawns.  But anyway, commenting based
on my current lcak of understanding, \V and \v would suppress some
amount of backtracking.  How do they differ?  And how do you define
how much backtracking they would suppress?  (?>) has an explicit scope
that seems necessary to me.  If $re uses \V or \v and $re2 uses /A$reB/,
how do you tell if \V/\v are meant to 'extend' into $re2 or not?

The only way I can see a \V or \v that did something different than
a (?>) ending at the same point, is if the \V or \v occurs in the
middle of a (explicit or implicit) grouping, such as /A|B\V|C/ or /A(B\V)C/
or something like that.  But I completely fail to understand what someone
would mean by this.

Help me, anyone?

In article <398DA75F.6AFBDC7E@home.com>,
Rick Delaney <rick.delaney@home.com> wrote:

> If you wanted to introduce these in an implementation independent way,
> it looks like you could define \v as a new operator where
> 
>     S\vT
> 
> is essentially the same as
> 
>     (?>S)T
> 
> but I don't think that's exactly what you have in mind.  And \v doesn't
> look very much like an operator.
> 
> I'm not sure how you could define \V.  Maybe
> 
>     S\VT == (?>S)(?:T|\F)
> 
> where \F means fail (which Ilya has shown can currently be done with
> (?{die}) wrapped in eval).

Maybe I'm just dense, but how does (?>S)T differ from (?>S)(?:T|\F)?

I suspect this is the root of my not understanding the difference between
\V and \v.



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