Java/Android regex test if in a string is a link
<pre><code>Pattern.compile("((http\\://|https\\://|ftp\\://|sftp\\://)|(www.))+((\\S+):(\\S+)@)?+(([a-zA-Z0-9\\.-]+\\.[a-zA-Z]{2,4})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(/[a-zA-Z0-9%:/-_\\?\\.'~]*)?");
</code></pre>

<p>I have this pattern, I'd like to test if there is a link in my string. 
I'd like to linkify those text in a <code>TextView</code>.</p>

<p>The code does not work when the link contains a <code>&amp;</code> character. </p>

<p>full code:</p>

<pre><code>Pattern httpMatcher = Pattern.compile("((http\\://|https\\://|ftp\\://|sftp\\://)|(www.))+((\\S+):(\\S+)@)?+(([a-zA-Z0-9\\.-]+\\.[a-zA-Z]{2,4})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(/[a-zA-Z0-9%:/-_\\?\\.'~]*)?");
String httpViewURL  = "myhttp://"; 
Linkify.addLinks(label, httpMatcher, httpViewURL);
</code></pre>
