I have a string of text that contains an IP address with hyphens and words. I want to extract the IP address from it using a regular expression that also converts the hyphens to periods.
So to clarify, can the IP address be extracted and the hyphens be replaced with periods purely with a regular expression without using the regex in some code such as Java or Python:
What I have
ip-10-179-50-22.corp.dept.org.uk
What I want
10.179.50.22
I'm thinking that I need to extract 4 groups based on numbers and concatenate them with periods, but I have no idea how to do this or if this is even possible with only regex?
What I've tried
(\d{2,3}-\d{2,3}-\d{2,3}-\d{2,3})
This gives me back 10-179-50-22 but I don't know how to replace on the matching group.
EDIT
I edited the question to clarify that I was trying to find a solution to find and replace with only a regular expression.
In summary, it looks like you can't just use a regex, but the regex needs to used with some code to achieve this