[thelist] Perl Regex

Jeremy Hare jeremy at billco.com
Wed Apr 4 04:20:41 CDT 2001


Or you can use U pattern modifier to make it ungreedy
----- Original Message ----- 
From: <thelist at lists.evolt.org>
To: <thelist at lists.evolt.org>
Sent: Tuesday, April 03, 2001 8:27 PM
Subject: Re: [thelist] Perl Regex


> 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
> 
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt ! 
> 





More information about the thelist mailing list