in reply to Question on Regex grouping
I'm looking to capture the value of the 8 digit number found in the second regex
foreach $arr ("foo abc12345 def12345678 bar") { if (($arr =~ /(\w*)(abc)(\d{5})/) && ($arr =~ / (\w*)(def)(\d{8})/ +)) { print $3; # "12345678" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question on Regex grouping
by ajguitarmaniac (Sexton) on Dec 21, 2010 at 06:36 UTC | |
by Anonymous Monk on Dec 21, 2010 at 06:46 UTC | |
by Anonyrnous Monk (Hermit) on Dec 21, 2010 at 06:49 UTC | |
by ajguitarmaniac (Sexton) on Dec 21, 2010 at 07:05 UTC | |
by Anonyrnous Monk (Hermit) on Dec 21, 2010 at 07:12 UTC | |
by ajguitarmaniac (Sexton) on Dec 21, 2010 at 07:40 UTC | |
by AnomalousMonk (Archbishop) on Dec 22, 2010 at 05:38 UTC |