title: DataAnnotations RegularExpression - disallow URLs
body: <p>I'm trying to create a DataAnnotation Regular Expression in ASP.NET MVC that will catch and disallow user-entered URLs. Basically, I want to catch any string that starts with http:// or https:// but my knowledge of Regular Expressions is weak. I can match strings that DO contain those strings with the following regex code:</p>
  
  <p>^(http://|https://)</p>
  
  <p>but I don't know how to negate it, so that, in my model,</p>
  
  <pre><code>    [RegularExpression(@"^(http:\/\/|https:\/\/)", ErrorMessage = "Entry should not contain url.")]
  </code></pre>
  
  <p>returns a Model error if http:// or https:// is found at the beginning of the string. </p>
  
  <p>I found the following: </p>
  
  <p>[RegularExpression(@"^(?!.<em>?(https?://)?([\da-z.-]+).([a-z.]{2,6})([/\w .-]</em>)<em>/?).</em>$", ErrorMessage = "Entry should not contain url.")] </p>
  
  <p>which catches URLs, but it doesn't allow periods in the string</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>