I want to extract the ip address from following string with Python re
"aa:xv172.31.2.27bb,"
Using the following pattern
ip_address = re.sub(r'.*([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*',
r'\1',ip_address)
results in
2.31.2.27
because the first operator is as greedy as possible. I want the ip address matcher to be "more greedy" to get the full ip address. How to do this?