How to add custom mask in Angular using ngx-mask?

893 Views Asked by At

I am trying to add a custom mask in angular using regular expression.

Here is the mask I want:

  1. Characters allowed: Capital Letters, Small Letters, and Numbers

  2. Length of the field: 20

  3. Can start the input using an alphabet and number as well.


WHAT I TRIED!

public customPatterns = { 'X': { pattern: new RegExp('\[a-zA-Z0-9\]')} };
<input formControlName ="number" matInput placeholder="Number" mask="X{20}">

PROBLEM I AM FACING!

Using the above expression, I am able to write only numbers. I am not able to right any alphabet character neither at the start nor in the middle.

0

There are 0 best solutions below