I want to make web links inside a textview clickable. I used this code
Pattern httpPattern = Pattern.compile("^(http|https)://");
After much searching and trial and error, this is the solution. Do not use the default Linkiny.WEB_URLS. Use a custom regex pattern that looks for links. I used the following (et is an EditText).
et.setLinksClickable(true); Pattern httpPattern = Pattern.compile("[a-z]+:\\/\\/[^ \\n]*"); Linkify.addLinks(et, httpPattern,"");
That will only linkify URLs and not other strings with 2 words separated by a full stop as Linkify.WEB_URLS can do.
If that regex is not good enough for your needs see the following link for heaps of tested alternatives that handle more complex cases https://mathiasbynens.be/demo/url-regex
Hope that helps someone else with the same issue.