# python 3.x – question on regexp ipv4 to match multiple ips

import re
x=”””hi
baby
10.10.10.255
10.10.10.200
world
“””

regnew=re.search(r'((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])’,x)
print(regnew)
print(regnew.group(0))

output
<re.Match object; span=(9, 21), match=”10.10.10.255″>
10.10.10.255

if i used findall as below
regnew=re.findall(r'((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).){3}(25[0-5]|2[0-4][0-
9]|1[0-9][0-9]|[1-9]?[0-9])’,x)
print(regnew)
[(’10.’, ’10’, ‘255’), (’10.’, ’10’, ‘200’)]

i also tried below way..but again it comes below output.
for line in x.split():

regnew=re.search(r'((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])',line)
print(regnew)


None
None
<re.Match object; span=(0, 12), match=”10.10.10.255″>
<re.Match object; span=(0, 12), match=”10.10.10.200″>
None

is there any way if i can fetch with the same regexp for multiple ip matches ?
i believe there would be a better way to get the multiples ip pattern to fetch