On Monday 14 April 2008 16:35, Sharan Basappa wrote:
> Hi,
>
> I am trying to capture the text between two tokens. These tokens
> always exist in pairs but can occur N times.
> I somehow dont get what I want.
>
> $str =~ m/tokena(.*)tokenb/ms;
> print $1;
>
Try

$str =~ m/tokena(.*?)tokenb/ms;

The ? after the * stops it being greedy - i.e. it stops at the 1st tokenb and 
not the last

Gary
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     

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


Reply via email to