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

Re: [MacPerl-AnyPerl] Regular Expression Problem



On Thu, 29 Apr 1999, Ronald J. Kimball wrote:

> [oops, want to send back to the list as well]
> 
> Arved suggested:
> > 
> > $text =~ s/See\salso\s(.+)\./&new_refs($1).'.'/ge;
> 
> This will not work if you have another sentence following the "See also" on
> the same line, because Arved used greedy matching.
> 
I agree, Ronald. As a matter of fact, when I saw Richard's problem the
first time around, I went for the /e solution right away (more for
cleanliness of logic than speed considerations), and used (.+?).

At the time I was running ActiveState (a recent build), and although it's
been happy with non-greedy RE's before, this one it barfed on, and I e
never did figure out why.

It's a valid point, and would have to be addressed in production code.

Arved



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org