Regex route constraint with negative lookahead in MVC 3

  • Question
  • Updated 3 years ago
Hello,

my SO question may be of interest to you, possibly there's an issue with the tester.

http://stackoverflow.com/questions/12...

Kind regards,
Stijn Herreman
Photo of Stijn Herreman

Stijn Herreman

  • 1 Post
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Steve WorthamSW

Steve Wortham, Official Rep

  • 128 Posts
  • 4 Reply Likes
It looks like it's just an issue of two different behaviors. Regex Hero counts all matches even if the match length is 0, whereas the Regex route constraint must do something different.

There are examples of this to be found with ASP.NET validation as well. For example, I recently learned that the RegularExpressionAttribute in MVC DataAnnotations will check to make sure that the string length is equal to the match length ( http://blog.regexhero.net/2012/09/asp... ). It could be that the routing constraints use the same behavior.