I want to extract the second last IP address from the below expression using regex:
18.223.194.15, 56.99.45.32, 32.65.27.65, 52.89.22.5, 123.12.22.53
Should get 52.89.22.5 from the above
16.45.98.14, 10.22.102.16
Should get 16.45.98.14 from the above
I was able to get the last IP or the first IP using the below regex commands but I am having trouble getting the second last ip
To get the last IP
(?<IP>([0-9]{1,3}\.){3}[0-9]{1,3})+$
To get the first IP
(?<IP>([0-9]{1,3}\.){3}[0-9]{1,3}),.*
Thanks in advance