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 6, 2000 13:35
Subject:
Re: Proposal for \v and \V, the small- and large- cut regex operators.
Message ID:
200008062035.NAA00151@ventrue.yahoo.com

Rick Delaney <rick.delaney@home.com> wrote:
|> Jeffrey Friedl wrote:
|> > I don't believe that you can have a meaningful understanding of Perl
|> > regex semantics without understaning the concept of how a
|> > nondeterministic finite automata engine works.
|> 
|> I disagree.  The section "Combining pieces together" in perlre seems
|> quite sufficient.

I think we agree -- it's just saying the same thing in a different way.

On one hand, I find the perlre way easier to understand simply because it
doesn't have the phrase "nondeterministic finite automata" in it :-)
On the other hand, I find it harder because it uses examples like A'B'
(A-prime B-prime) which remind me of math theory, which puts me to sleep. 
YMMV.


|> Everything else is just illustration. It might be useful to illustrate
|> regexp behaviour by discussing the NFA approach, but it is not necessary
|> since regexps could (theoretically) be implemented differently.

Indeed, which is what Perl does (perl emphasizes the "N" of NFA,
and doesn't emphasieze the "F" so much :-)

|> 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.

For that example, yes, it is. But there are situations where \v could
not be described with (?>...).  Also, it's much less clutter.

|> And \v doesn't look very much like an operator.

I sort of like how it looks like a wedge, but its apperance is not really
important to discuss until it's decided if the functionality is worth
adding.
	Jeffrey



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