Add external class to links not on domain OR subdomain
<p>I'd like to add an external class to links that are not on our domain...easy to find a solution but it doesn't catch subdomains.</p>

<p>So, how can I use addClass("external") on  tags only where the href hostlocation DOESN'T contain 'hw.ac.uk'?</p>

<p>Following is popular but doesn't catch subdomains (of which ours can be one or two deep, e.g., subdomain., www.subdomain., etc.)</p>

<pre><code>$("a").filter(function() {
return this.hostname &amp;&amp; this.hostname !== location.hostname;
}).addClass('external');
</code></pre>

<p>I guess I want the opposite of <a href="http://stackoverflow.com/questions/1713222/add-class-to-all-links-that-link-to-a-certain-domain-with-js-jquery">add class to all links that link to a certain domain with js (jquery)</a></p>

<p>Thanks</p>

<p>Neil</p>
