<p>I need to test a url that it <strong>does not</strong> end with <code>.asp</code></p>

<p>So <code>test</code>, <code>test.html</code> and <code>test.aspx</code> should match, but <code>test.asp</code> should not match.</p>

<p>Normally you'd test if the url <strong>does</strong> end with .asp and negate the fact that it matched using the NOT operator in code:</p>

<pre><code>if(!regex.IsMatch(url)) { // Do something }
</code></pre>

<p>In that case the regular expression would be <code>\.asp$</code> but in this case I need the regular expression to result in a match. </p>

<hr>

<p>Background: I need to use the regular expression as a route contraint in the ASP.NET MVC <code>RouteCollection.MapRoute</code> extension method. The route needs to match all controllers but it should fall through when the controller in the url ends with .asp</p>

Try this
```
```
^((?!\.asp$).)*$
```
```