jQuery inputmask no limit on number of characters
Asked Answered
B

1

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.

Battik answered 1/12, 2016 at 23:2 Comment(0)
D
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 :)

Demirelief answered 26/1, 2017 at 14:38 Comment(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...!Horsetail

© 2022 - 2024 — McMap. All rights reserved.