in reply to Regex expression to match...
The following will match two words in a row:
use strict; use warnings; my @strings = qw( /help/one/one/one/something_here /buy/cash/buy/water/water/water/nothing_here ); for (@strings) { if (m{\b(\w+)/\1\b}) { print "Dup is '$1'\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Regex expression to match...
by Sewi (Friar) on Jun 17, 2011 at 07:16 UTC | |
Re^2: Regex expression to match...
by dxxd116 (Beadle) on Jun 17, 2011 at 18:15 UTC | |
by wind (Priest) on Jun 17, 2011 at 19:38 UTC |
In Section
Seekers of Perl Wisdom