A few things I've spotted real quick
1: why is the 7 escaped in your regex @ gopher)\72
2: HTTPS, FTP and gopher, afaik, is a competely different protocol from http, meaning the GET ... Host: headers are invalidly used.
3: Instead of coding the 'redirect' for puu.sh, why not just have your sockets follow redirects?
I didn't really test it, but i think this would be a far better regex:
/(?:http:\/\/)?(?:www\.)?(|(\S+\.(?:jpe?g|gif|png))|(puu\.sh\/\w+))/Sig
@Conscious after I commented, I remember
@SReject It works for https links. What are you doing? I also thinkit would work for FTP links. I don't know shit about gopher.
Appreciate it though. Can you add imgur in there? (I'm shit with regex).
@illhawkthat It doesn't work for https or ftp links. It is basically converting the URL to a HTTP link. Some/Most servers support an HTTP fall back for HTTPS links.
Sorry if I keep coming off sounding arrogant, it's not my intention. If you wanted true HTTPS(not sure, but I think FTP aswell) support, you could use one of these inplace of your sockets:
Call back style downloading of a file:
http://www.hawkee.com/snippet/9318/
Semi-blocking downloading of a file:
http://www.hawkee.com/snippet/8993/
Thanks @Conscious I'll put up a new regex string within the week when I can find someone to make one for me haha. I appreciate all the feedback!
Thanks for the feedback @SReject
1 and 2 - I'm not sure because I didn't make the regex string. (thanks to Wiz126 #msl swiftirc for it) - I will look into changing it to better fit this script in the future. (Also I don't really see people link to FTP or Gopher images so they seem useless haha)
I made some edits to the code above.