Does anyone know of a regular expression I could use to find URLs within a string? I\'ve found a lot of regular expressions on Google for determining if an entire string is
A probably too simplistic, but working method might be:
[localhost|http|https|ftp|file]+://[\w\S(\.|:|/)]+
I tested it on Python and as long as the string parsing contains a space before and after and none in the url (which I have never seen before) it should be fine.
Here is an online ide demonstrating it
However here are some benefits of using it:
file:
and localhost
as well as ip addresses#
or -
(see url of this post)