I'm looking for a Regex that will find URLs in a string but ignore pre/following characters which are not part of the URL.
for example, from the string:
example.co.uk (main site: example.com)
,
The Regex will find:
example.co.uk
and exaple.com
.
In order to find URLs within a given string, I use the Regex '#(www\.|https?://)?[a-z0-9]+\.[a-z0-9]{2,4}\S*#i'
.
The problem is that if I use this regex with the given string above, it finds example.co.uk
and example.com)
with the closing bracket at the end.
Is there any Regex that can find URLs in a string, not matter what characters it has from both sides?
Thanks!