UPDATE 9 July 2012 – Looks like this is fixed in RTM.
- We already imply
^
and$
so you don’t need to add them. (It doesn’t appear to be a problem to include them, but you don’t need them) - This appears to be a bug in ASP.NET MVC 4/Preview/Beta. I’ve opened a bug
View source shows the following:
data-val-regex-pattern="([a-zA-Z0-9 .&'-]+)" <-- MVC 3
data-val-regex-pattern="([a-zA-Z0-9 .&amp;&#39;-]+)" <-- MVC 4/Beta
It looks like we’re double encoding.