I need to extract IP address in the form
prosseek.amer.corp.com [10.0.40.147]
or
prosseek.amer.corp.com (10.0.40.147)
with Python. How can I get the IP for either case with Python? I started with something like
site = "prosseek.amer.corp.com"
m = re.search("%s.*[\(\[](\d+\.\d+\.\d+\.\d+)" % site, r)
but it doesn't work.
ADDED
m = re.search("%s.+(\(|\[)(\d+\.\d+\.\d+\.\d+)" % site, r)
m.group(2)
m = re.search(r"%s.*[([](\d+\.\d+\.\d+\.\d+)" % site, r)
m.group(1)
seems to work.