On Thu, 2003-03-06 at 09:32, Francesco del Vecchio wrote:
> If I have a string as the following:
> aaaaa xxxxxx bbbbb aaaaa xxxxx bbbbb
> and I try a m/aaaaa(.*)bbbbb/g
> $1 = xxxxxx bbbbb aaaaa xxxxx
> what have I to do to obtain two matches each of one give me
> $1 = xxxxx
#!/usr/bin/perl -w
use strict;
my $string='aaaaa first bbbbb aaaaa second bbbbb';
while ($string=~/aaaaa(.*?)bbbbb/g) {
print "-->$1<--\n";
}
prints:
--> first <--
--> second <--
the (.*?) says capture any character, but capture as few as possible.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]