Yup!

Thanks,

-Nilanjan

-----Original Message-----
From: Kripa Sundar [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 12, 2005 6:22 PM
To: Palit, Nilanjan
Cc: Boston.PM Mongers
Subject: Re: [Boston.pm] Perl RE: first occurrence of a pattern?

Dear Nilanjan,

> If I used a RE like the following:
> 
> $dir =~ m,^(.*)/($fruits)/,;
> 
> I get a greedy match, upto & including the last occurrence. Is there a
> RE to get the path up to the first occurrence of any one of the
> alternatives?

Doesn't non-greedy quantification solve your problem?

> $dir =~ m,^(.*?)/($fruits)/,;

Or have I mis-understood the problem?

peace,               || Udayachal: a newspaper edited by slum children:
--{kr.pA}            || http://tinyurl.com/57jaf
-- 
This .sig intentionally left blank.
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to