Question: Need help with validation annotation in ASP.Net core MVC. When I test out the fields, it gives errors stating the fields do not match the

Need help with validation annotation in ASP.Net core MVC. When I test out the fields, it gives errors stating the fields do not match the given regex.

Question 1: The pizza name field is required, and only consists of English letters, digits, spaces and underscore, and has a length between 3 characters and 20 characters inclusive.

Question 2: The pizza price should be in the range from $5.00 to $20.00 inclusive.

Answer to question 1: [RegularExpression(@"[A-Z][a-z_ ][0-9]{3,20}")]

Answer to question 2: [RegularExpression(@"${5.00,20.00}")]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!