ngx-mask icon indicating copy to clipboard operation
ngx-mask copied to clipboard

when using "*" character as a custom pattern, it gets counted as one less than the amount entered

Open 101niks opened this issue 3 years ago • 1 comments

hi, I am trying to use '*' as a custom pattern:

customPattern = {
   '9' : { pattern: new RegExp('\[0-9\]') },
   'a' : { pattern: new RegExp('\[a-zA-Z\]') },
   '*' : { pattern: new RegExp('\[a-zA-Z0-9\]') }
 };

myMask = "***-***"

in html:

<input type="text" [mask]="this.myMask" [patterns]="this.customPattern">

the mask is functioning as if I entered **-** instead of ***-***, if I change the mask to ****-****, then it functions as ***-*** always acting as if there is one less star character than I have entered. Am I doing something wrong on my end? Are there any workarounds? Any input is appreciated

101niks avatar Feb 16 '22 15:02 101niks

this is probably related to #958 , I was not able to find that ticket via search but just saw it

101niks avatar Feb 16 '22 15:02 101niks

Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-dn6ajx?file=src%2Fmain.ts

andriikamaldinov1 avatar Jun 30 '23 15:06 andriikamaldinov1