I have to find the last occurrence of an ip address in a string using regex. I found this
addr = re.search(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', program[line])
which finds the first occurrence. How can I change it to find the last one?
I have to find the last occurrence of an ip address in a string using regex. I found this
addr = re.search(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', program[line])
which finds the first occurrence. How can I change it to find the last one?
re.findall(pattern, string)[-1]