hoping someone can point out what I'm missing here with a regular expression.
Here is the data item from my model :-
[Display(Name = "Serial to Search")]
[MaxLength(12)]
[RegularExpression(@"ABC|WXYZ\w{8,9}")]
public string SerialNo { get; set; }
This should allow me to match a serial that begins with either ABC or WXYZ and has another 8 or 9 characters/numbers.
In my view I'm using jquery unobtrusive validation and an @Html.ValidationMessageFor control to display errors.
I have tested this on regex101.com using the following test string :-
ABCGC1000BC5
and it passes fine, but in my view I get a validation error, specifically that the string doesn't match the regex requirements. Can anyone see what I'm missing ? Thanks.
(ABC|WXYZ)\w{8,9}