I have the following property in my view model:
[Required] [MaxLength(12)] [MinLength(1)] [RegularExpression(\"[^0-9]\", ErrorMessage = \"UPRN must be numeri
The regular expression is wrong. Replace it with:
[Required] [MaxLength(12)] [MinLength(1)] [RegularExpression("^[0-9]*$", ErrorMessage = "UPRN must be numeric")] public string Uprn { get; set; }
Don't forget to include:
@Scripts.Render("~/bundles/jqueryval")
in your view for the jquery validation