and this is your regex:ec0: flags=410c43<UP,BROADCAST,RUNNING,FILTMULTI,MULTICAST,LINK0,IPALI +AS> inet 172.22.43.157 netmask 0xfffffc00 broadcast 172.22.43.255
The problem is that you're trying to match and capture everything in the string up to and including the first IP address, when you don't need to. It's failing because of the part inet\w -- you're looking for an alphanumeric character immediately after the "t" of "inet", and there isn't one. The following would do what you want:/^(.*\n.*inet\w)(\d{1,3}\.\d{1,3}\.\d{1,3})/
That is, match and capture the first three components of the IP address that follows one or more whitespace characters immediately after the first occurrence of "inet".my ($ip_address) = ( /inet\s+(\d{1,3}\.\d{1,3}\.d{1,3})/ );
In reply to Re: Re: Re: Back in the saddle...
by graff
in thread Back in the saddle...
by gnubbs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |