A regular expression is a formal pattern for matching character combinations in strings. In ASP.NET Core validation, the RegularExpression attribute applies such a pattern to incoming values. section 6.1.3
For a board-game API endpoint, the pattern-based validation flow is:
- Place a RegularExpression attribute on the parameter that requires constrained text. section 6.1.3
- Write a pattern such as ASC|DESC to match either permitted sort direction. section 6.1.3
- Let the .NET regular expression engine use IsMatch internally to determine whether the input matches. section 6.1.3
Validating sort order
Annotating sortOrder with [RegularExpression("ASC|DESC")] accepts ASC or DESC while rejecting other values during request validation. section 6.1.3


























