Html input type textbox pattern

Monisha S 21 Reputation points
2022-06-27T08:29:21.007+00:00

I have an html input type textbox , i need to restrict it by following pattern

Ex pattern :A1*A2+A3

Accepted aphanumeric character between A1-A5

1)textbox should in above pattern A alphabet followed by numeric value between 1-5
2) it should include arithmetic operators like A1+A2 *A4 and so on

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,207 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,288 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Cristian Mayo 1 Reputation point
    2022-06-27T16:26:01.073+00:00

    You can achieve this either client-side or server-side.

    For client-side, you can mask the HTML input using using JavaScript. Check this page for reference.

    And if you need server-side, create a custom validation attributes with model data annotations. You can check this page to familiarize with the validation attributes. Then you can search how to do a custom validation attribute so that you could achieve your logical criteria for masking the input.

    0 comments No comments