title: Regex - Match any sequence of characters except a particular word in a URL
body: <p>I want to match a URL that contains any sequence of valid URL characters but not a particular word. The URL in question <a href="http://gateway.ovid.com" rel="noreferrer">http://gateway.ovid.com</a> and I want to match anything but the word 'gateway' so:</p>
  
  <ul>
  <li><a href="http://abc123.ovid.com" rel="noreferrer">http://abc123.ovid.com</a> - would match</li>
  <li><a href="http://abc.123.ovid.com" rel="noreferrer">http://abc.123.ovid.com</a> - would match</li>
  <li><a href="http://abc-123.ovid.com" rel="noreferrer">http://abc-123.ovid.com</a> - would match</li>
  <li><a href="http://fdfsffdfs.ovid.com" rel="noreferrer">http://fdfsffdfs.ovid.com</a> - would match</li>
  </ul>
  
  <p>but</p>
  
  <ul>
  <li><a href="http://gateway.ovid.com" rel="noreferrer">http://gateway.ovid.com</a> - would <strong>NOT</strong> match</li>
  </ul>
  
  <p>Something like the following:</p>
  
  <pre><code>^http://([a-z0-9\-\.]+|(?&lt;!gateway))\.ovid\.com$
  </code></pre>
  
  <p>but it doesn't seem to work.</p>
  
  <hr>
  
  <p><strong>Update:</strong> Sorry forget to mention the language, it's C#.NET</p>