At 05:29 PM 28/05/2001 +0100, Bornaz, Daniel wrote:
>Dear all,
>
>I am trying the following code using ActivePerl 5.6.1.626, in my quest to
>find the minimal string between "bar" and "river":
>
>$stt="The food is under the bar in the barn in the river.";
>$stt=~/bar(.*?)river/;
>print "$&";
>
>The output is:
>bar in the barn in the river
>
>Instead of the expected:
>barn in the river

 From what I read this would be correct, you are asking for everything but 
don't be greedy in between "bar" and "river"...
"bar" is an explicit match, if you want to match "barn" then I suggest this...

$stt="The food is under the bar in the barn in the river.";
$stt=~/barn(.*?)river/; # looks for barn not bar.
print "$&";


/***** Experience is that marvelous thing that enables you to recognize a 
mistake when you make it again.
Franklin P. Jones *****/

Reply via email to