[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] innermost first parsing



On Wed, Aug 02, 2000 at 08:54:55AM -0700, Randal L. Schwartz wrote:
> >>>>> "Jeff" == Jeff Pinyan <jeffp@crusoe.net> writes:
> 
> Jeff>   ($first) = $text =~ m{
> Jeff>     BEGIN
> Jeff>     (
> Jeff>       [^BE]*  # 'B' and 'E' are first chars of tags
> Jeff>       (?:
> Jeff>         (?:
> Jeff>           B+ (?! EGIN )  # match /B+/ if NOT 'BEGIN'

> I think yours fails on BEGIN ... BBBBBEGIN ... END ... END
> as well, since you grab the multiple B's but only check the first
> B for BEGIN'ness. :)

I don't think that's right.  B+(?!EGIN) checks each B for BEGIN-ness.
In BBBBEGIN, it will match the first three Bs and reject the fourth, which
is followed by EGIN.

The problem is with the comment, which is misleading.

But I had to test it to convince myself that it worked.  :)

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe