I\'ve seen similar questions asked before, but none with a working solution.
I am trying to replace all urls on a page with anchor tags, but only those which aren\'t alr
For jobs like this, I normally recommend people do it with code rather than regex because regex gets really messy, really fast. However, if you do want a regex, here is a workable solution. Please go to the link to get a full understanding and view of test cases I used.
http://regex101.com/r/kL3iL7
(?:http([s]?):\/\/)?((\w+[.])+\w+(\/\w*)*(\?[^\s]*)*)(?![^\s]*>)
with replacement
\2
I do not promise that is is perfect, but it does handle a lot of cases. Let me know if there are any test cases it needs to be fixed for.