This is my controller action method, I am trying to validate a string using Regular Expressions, the condition works but it always shows the default error message instead of the custom message.
[HttpGet("{number}")] public async Task<IActionResult> GetDetails( [FromRoute][RegularExpression(@"^d{2}-d{3}-d{4}-d{5}$", ErrorMessage = "Invalid format for number.")] string number)
Expecting: It should show the custom error message which is binded with the property ErrorMessage
of RegularExpression attribute