D
Dustin D.
If I attempt to crop a string using regular expressions and the ()
operator for grouping, Perl always seems to return the last match.
For instance, if I have the following:
my $test = "a0\nb0\nc0\na1\nb1\nc1\n";
$test =~ s/.*(\w\d\n).*/$1/s;
print "$test";
The output would be:
c1
I don't understand why it's not a0? Any ideas?
Thanks,
Dustin
operator for grouping, Perl always seems to return the last match.
For instance, if I have the following:
my $test = "a0\nb0\nc0\na1\nb1\nc1\n";
$test =~ s/.*(\w\d\n).*/$1/s;
print "$test";
The output would be:
c1
I don't understand why it's not a0? Any ideas?
Thanks,
Dustin