[thelist] Perl Regex

Tobyn Baugher trb at cartoonviolence.net
Wed Apr 4 00:27:55 CDT 2001


On Wed, Apr 04, 2001 at 09:29:37AM +0530, Manish Sharma wrote:
> s/<.+>//;
> will not work!
> 
> If I use the above REGEX on the following line:
> <TITLE>Test title</TITLE>
> it matches the entire line! (Picks up the fist < and the last >)

You ran into Perl's greedy matching :). I believe changing .+ with .+?
will fix your problem.

Regards,
Toby

-- 
Tobyn "trb" Baugher <trb at cartoonviolence.net>
http://www.cartoonviolence.net
AIM:unlewp ICQ:14281524 EFnet:trb




More information about the thelist mailing list