title: Regex to match all URLs except certain URLs
body: <p>I need to match all valid URLs except: </p>
  
  <blockquote>
    <p><a href="http://www.w3.org" rel="nofollow noreferrer">http://www.w3.org</a><br>
     <a href="http://w3.org/foo" rel="nofollow noreferrer">http://w3.org/foo</a><br>
    <a href="http://www.tempuri.org/foo" rel="nofollow noreferrer">http://www.tempuri.org/foo</a>  </p>
  </blockquote>
  
  <p>Generally, all URLs except certain domains. </p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?  
  </code></pre>
  
  <p>will match URLs that are close enough to my needs (but in no way all valid URLs!) (thanks, <a href="http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/" rel="nofollow noreferrer">http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/</a>!)</p>
  
  <pre><code>https?://www\.(?!tempuri|w3)\S*
  </code></pre>
  
  <p>will match all URLs with <code>www.</code>, but not in the <code>tempuri</code> or <code>w3</code> domain.</p>
  
  <p>And I really want </p>
  
  <pre><code>https?://([-\w\.]+)(?!tempuri|w3)\S*
  </code></pre>
  
  <p>to work, but afaick, it seems to select all <code>http://</code> strings.</p>
  
  <p>Gah, I should just do this in something higher up the Chomsky hierarchy!</p>