I am looking for a regex that matches valid, online addresses.
For instance:
exmaple.com
http:
https:
www.exmaple.com
http:
https:
And special domains and extensions, such as:
t.co
example.deals
sh.party
And so on, but will not meet all the complex things like ftp, getquery or URL-address type 2.3.3.1.
I used '#(www\.|https?://)?[a-z0-9]+\.[a-z0-9]{2,4}\S*#i', but it detects dates , for example 3.3.2017.
I need this because I apply get_headersto every URL found, and when I do get_headersfor invalid URLs such as date, I get:
get_headers(http://03.03.2017): failed to open stream: Connection timed out
TL DR: I am looking for a regex that matches only URLs that you can apply get_headers()on.
Thanks for the help!