dru145 has asked for the wisdom of the Perl Monks concerning the following question:
I'm caputuring the ip and servername into separate arrays. Here is my regex that does this:192.168.89.1 acmeorp.acme.com 192.168.31.3 ftp.acme.com 192.168.19.179 [Unknown]
My question is, is there a way to reference the ip match in my regex that matches the server name? I thought this would work, but it doesn't:push (@ips, $1) if /\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b/; push (@names, $1) if /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b\s{2,}(\w[ +^\s]*|\[Unknown\])\s{2}/;
#push (@names, $1) if /$1\s{2,}(\w[^\s]*|\[Unknown\])\s{2}/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Referencing a Backreference
by gav^ (Curate) on Mar 14, 2002 at 16:26 UTC | |
by Juerd (Abbot) on Mar 14, 2002 at 16:49 UTC | |
by belg4mit (Prior) on Mar 14, 2002 at 20:26 UTC | |
|
Re: Referencing a Backreference
by PrimeLord (Pilgrim) on Mar 14, 2002 at 16:54 UTC | |
|
Re: Referencing a Backreference
by dru145 (Friar) on Mar 14, 2002 at 17:07 UTC | |
by thunders (Priest) on Mar 14, 2002 at 18:59 UTC |