Forum Moderators: open
I can't seem to get the protocol to be optional. I'm trying to get both "http://www.example.com" and "www.example.com" to match (as it stands, a match only occurs with http: //, etc. present). I can't get the? in the correct spot, without messing the whole thing up. Optimally, I would like the colon and slashes to be optional too (i.e. http: //).Thanks for any help given.
I put spaces in the http so it wouldn't create a link on this board
((^¦[ \t\r\n])(((http¦https¦ftp)\://)?)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*[^\.\,\)\(\s])
This pattern will match any url, with the protocol being optional. Combine it with some functionality that adds a link, and you've got an auto-activating url.