(E-Mail Removed) wrote:
> rx_hwaddr=re.compile('^(\w+).+([0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2})')
> rx_inet_addr=re.compile('^.+inet
> addr
\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})')
rx_hwaddr=re.compile('^(\w+).+([0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2})')
rx_inet_addr=re.compile('^.+inet
addr

\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})')
I think I'd avoid anchoring to anything here. You want your mac
address to be a definitive mac address, which means that the characters
on either side are NOT acceptable to be a mac address, meaning they're
whitespace or similar, or an end of line. Also, the inet address is
anchored to the front of the line, which it isn't guaranteed to do.
You have "^.+inet addr" but maybe \<inet addr:?\s*(\d{1,3}... would
work better?
Forgive my regular expressions, I haven't worked in Python ever, and
haven't worked perl in a long while. My regex syntax is probably mixed
in a little with how it works in vim. My point is, to take the
absolute minimum hardware address and the absolute minimum inet
address, and only look at those.