in reply to Re: regular expression
in thread regular expression


That works. I expected it would fail because the first group would match everything and then there would be nothing for the 2nd group to match against.

Here's the code I used to test:

#! /usr/bin/perl -w -T use strict; my $str = 'foo_bar_foo_bar_12345'; print "$str\n"; $str =~ /(.*)(\1.*)/ || die "Failed!\n"; print "$2\n";

Can anyone explaine why that is?