I have the following property in my view model:
[Required] [MaxLength(12)] [MinLength(1)] [RegularExpression(\"[^0-9]\", ErrorMessage = \"UPRN must be numeri
Or you could do the length validation in the regexp:
[Required] [RegularExpression("^[0-9]{1,12}$", ErrorMessage = "...")] public string Uprn { get; set; }
Here's the regex visualized:
Debuggex Demo