1
I am trying to make a customAlias to use with jQuery Inputmask, but I am facing the following problem:
My input:
<input id="input-field-nome" data-inputmask="'alias':'customAlias'" type="text" data-rule-required="true" class="form-control required" placeholder="Nome e sobrenome">
Javascript:
Inputmask.extendAliases({
'customAlias': {
autoUnmask: true,
placeholder: "",
mask: "a",
definitions: { "a" : { validator: "[a-zA-Z]+" } }
}
});
//initializing the plugin
$(":input").inputmask({
placeholder: ''
});
I understood that the line validator: "[a-zA-Z]+"
should work as follows: 'any letter once or more, but the quantifier +
is not working. I can only insert a letter in the field.
I tried the following ways, but none solved:
"validator": "[a-zA-Z\+]",
- I saw something like this on the plugin examples page.
"validator": "[a-zA-Z]\+",
- I thought that escaping the + would be the solution, but no.
+1 and follows the fiddle =D
– Brunno
Good @Marcosregis, this solves my problem. Out of curiosity, you know why in the regex of Validator I can not use any quantifier? I tried '+', '*', '{1, 10}', '{10}' and nothing. It would be great if it worked
– Victor Alencar Santos
interestingly, here at my place, only with s worked. Already in the fiddle I needed to use s
– Marcos Regis
@Victoralencarsantos I don’t use this plugin (I also use masks, but I use another plugin) and I don’t know exactly why. Apparently he does not use Validator as a de facto regex. He only accepts the qualifiers to then form the final regex.
– Marcos Regis
Got it, thank you very much! :)
– Victor Alencar Santos