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

HELP: Using Prefix/Suffix - What is the mask value to accept all characters of any length?

Open bkarv opened this issue 3 years ago • 1 comments

Description

Thanks for this great plugin. We purely want to use this feature to add prefix and suffix to the input text. The only thing we can't workout what is the mask value that can accept any character (ie Integers, decimals, upper and lower case letters) of any length?

Thanks in advance.

bkarv avatar Feb 13 '22 10:02 bkarv

Hi I was also working on same issue… I wanted the text input to start with “I Will” but limit it to 80 characters.

I achieved it by,

<input
   mask="N{80}"
   [specialCharacters]="['  ']"
   [dropSpecialCharacters]="false"
   [pattern]="myPattern"
/>

And in compontent.ts

myPattern = { N: { pattern: new RegExp('[ -~]'), optional: true } }

needless to say, but increase N{80} to bigger number like N{10000} and your problem will be solved

reezpatel avatar Feb 14 '22 14:02 reezpatel

@bkarv Thanks for using Ngx-mask. It example for ur case - https://stackblitz.com/edit/angular-9qkmhg?file=src%2Fmain.ts If you need to add more specialCharacters u can add it to pattern

andriikamaldinov1 avatar Sep 04 '23 11:09 andriikamaldinov1