Perhaps I’m missing the question, but there is a regular expression for matching a URI. Remove the leading carat and it can match anywhere in a text.
https://tools.ietf.org/html/rfc3986#appendix-B
Edit: I see it's not quite that simple. However, I still think that with some stricter matching requirements this could work.