-1

I have a below and many more below like strings in list.. I have to extract the IP addresses only from each string.

"Below server have been decommissioned via # C180013538 & C180025327 request.
Please remove any firewall rules associated with this server, So that the IP\'s can be re-used in the future. Please refer attachment for FW rules removal server details.", \'Server Details :- \', \'ServerName IP Address\', \'CHIIUGA06RR
10.103.225.37\', \'CICCKDBP11VE 10.103.113.11\', \'CICCKDBP12VE 10.103.113.13\ /"

Expected Result : - 10.103.225.37 10.103.113.11 10.103.113.13

Atul
  • 1
  • 3

1 Answers1

0
import re

list = ["\'Server Details :- \', \'ServerName IP Address\', \'CHIIUGA06RR 10.103.225.37\', \'CICCKDBP11VE 10.103.113.11\', \'CICCKDBP12VE 10.103.113.13\ /", 
"\'Server Details :- \', \'ServerName IP Address\', \'CHIIUGA06RR 10.103.225.37\', \'CICCKDBP11VE 10.103.113.11\', \'CICCKDBP12VE 10.103.113.13\ /"]

for s in list:
    print re.findall( r'[0-9]+(?:\.[0-9]+){3}',  s)

See: Extract IP address from an html string (python)

ash2072
  • 1
  • 2