Untested code.

$str = mississippi;
$str =~ m/m(.*i)/;
print $1; # Should output mississippi

$str = mississippi;
$str =~ m/m(.*i)(.*pi)/;
This requires $2 to have .*pi in it. Since this is a greedy RegEx, $1
will grab mississi (must end by an i) and leave as little as possible
for $2 - ie ppi.

Um. Hope this post helped!

On 5/31/07, Sharan Basappa <[EMAIL PROTECTED]> wrote:
Thanks a lot Paul ..

For this rule :
$str = mississippi;
$str =~ m/m(.*i)(.*pi)/;

My initial understanding was that .*i would match all the way till last char i.
This would indeed be true if .*i was not followed by .*pi.
Do you agree ?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to