in reply to Re: regular expression
in thread regular expression
Woah!
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: regular expression
by Athanasius (Archbishop) on Aug 03, 2012 at 17:21 UTC | |
by pileofrogs (Priest) on Aug 03, 2012 at 17:23 UTC |
In Section
Seekers of Perl Wisdom