Regex route constraint with negative lookahead in MVC 3

  • 1
  • Question
  • Updated 5 years ago

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

Kind regards,
Stijn Herreman
Photo of Stijn Herreman

Stijn Herreman

  • 1 Post
  • 0 Reply Likes

Posted 5 years ago

  • 1
Photo of Steve Wortham

Steve Wortham, Official Rep

  • 136 Posts
  • 5 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 ( ). It could be that the routing constraints use the same behavior.