I have been trying to parse a numerical address from a string using regex.
So far, I have been able to successfully get the numerical address (partially) 22.214.171.124:80 from the string http://126.96.36.199:80/. However I have been trying to skip over the :80/, and have had no luck.
What I have tried so far is:
You are looking for a positive look ahead
(?=...). This will match only if it is followed by a specific expression, the one in the positive look ahead's parenthesis. In it's simplest form you could have
Though you may want to change the
[0-9\.]+ part (match 1 or more digit or full stop) with something more complete to check that you have a properly formed address
Check out regexr.com where you can fiddle your expression to your heart's content until it works...