On Sat, 2006-01-07 at 01:29 +0200, Filip Jursik wrote:
> Well, I thought, that when I write:
> 1) /A(.*)B/, $1 will hold the longest string enclosed by A and B
> 2) /A(.*?)B/, $1 will hold the shortest string enclosed by A and B
>
> Does it work like this or the "?" after the ".*" has a different
Rob Dixon schreef:
> Filip Jursik:
>> $text = "first first second third";
>> $text =~ /(first.*?third)/;
>> print $1;
>> gives me
>> "first first second third"
>> as a result instead of expected
>> "first second third"
>
> The regex engine will match one element at a time. Your
Filip Jursik schreef:
> $text = "first first second third";
> $text =~ /(first.*?third)/;
> print $1;
>
> gives me
>
> "first first second third"
>
> as a result instead of expected
>
> "first second third"
The match starts at the first possible position, or in other words: *?
doesn't look back.
!!!
THANK YOU! :)
F.
Rob Dixon wrote:
Filip Jursik wrote:
Hi,
this
$text = "first first second third";
$text =~ /(first.*?third)/;
print $1;
gives me
"first first second third"
as a result instead of expected
"first second third"
What am I doing wrong? I've expected the .*? to limit th
Mr. Shawn H. Corey wrote:
On Fri, 2006-30-06 at 23:04 +0200, Filip Jursik wrote:
Hi,
this
$text = "first first second third";
$text =~ /(first.*?third)/;
print $1;
gives me
"first first second third"
as a result instead of expected
"first second third"
What am I doing wrong? I've expected
Filip Jursik wrote:
Hi,
this
$text = "first first second third";
$text =~ /(first.*?third)/;
print $1;
gives me
"first first second third"
as a result instead of expected
"first second third"
What am I doing wrong? I've expected the .*? to limit the wildcard only
to the string " second ".
Filip Jursik wrote:
> Hi,
Hello,
> this
>
> $text = "first first second third";
> $text =~ /(first.*?third)/;
> print $1;
>
> gives me
>
> "first first second third"
>
> as a result instead of expected
>
> "first second third"
>
> What am I doing wrong? I've expected the .*? to limit the wi
On Fri, 2006-30-06 at 23:04 +0200, Filip Jursik wrote:
> Hi,
>
> this
>
> $text = "first first second third";
> $text =~ /(first.*?third)/;
> print $1;
>
> gives me
>
> "first first second third"
>
> as a result instead of expected
>
> "first second third"
>
> What am I doing wrong? I've exp
On Fri, 2006-06-30 at 23:04 +0200, Filip Jursik wrote:
> Hi,
>
> this
>
> $text = "first first second third";
> $text =~ /(first.*?third)/;
> print $1;
>
> gives me
>
> "first first second third"
>
> as a result instead of expected
>
> "first second third"
>
> What am I doing wrong? I've exp
Hi,
this
$text = "first first second third";
$text =~ /(first.*?third)/;
print $1;
gives me
"first first second third"
as a result instead of expected
"first second third"
What am I doing wrong? I've expected the .*? to limit the wildcard only to the
string " second ".
Thanx,
F.
--
To
10 matches
Mail list logo