7

I'm using the jQuery inputmask plugin for masking a text field (https://github.com/RobinHerbots/Inputmask). I can't figure out the syntax for masking an unlimited number of alphanumeric characters. This seems like it should be simple I just can't seem to find the answer in in the documentation or another stackoverflow question. So far this works:

$('.inputmask_alphanumeric').inputmask({ mask: "[*]{100}", greedy: false });

{100} is a generous number for now, but I want this to be a generic class rule for any long text input in the future. I tried {*} and {+} but they didn't seem to work. Thanks.

wzsmith1
  • 73
  • 1
  • 5

1 Answers1

10
  • [] optional
  • () group
  • {} range

[*]{100} == Optional char * must be entered 100 times

You need *{0,} to create a min:0 and max:infinite mask

Or {1,} to create a min:1 and max:infinite

and so on :)

greenseed
  • 509
  • 5
  • 10
  • 1
    I've been reading documentation of this jquery library regex, and this answer is just too clear and 100% understandable, why people make it so complicated... This answer made my day...! – Flamur Beqiraj Apr 26 '19 at 07:06