0

How I can add multiple alphanumeric characters. In regular expression we use [a-zA-z0-9 ]+, + signifies you can add atleast one alphanumeric. So, how I can achieve this through mask i.e. adding multiple alphanumeric characters.

I have tried the following:

jQuery('.alphanumeric-field').mask('A')

MaartenDev
  • 5,631
  • 5
  • 21
  • 33
  • Does this answer your question? [Mask javascript variable value](https://stackoverflow.com/questions/17650197/mask-javascript-variable-value) – Jay May 15 '20 at 10:34
  • Are you using a third party plugin? If so which one? If not, how are you generating the .mask()? – freedomn-m May 15 '20 at 10:36
  • I find it: $('.Address, .APT').mask('Z', { translation: { 'Z': { pattern: "^[a-zA-Z0-9_ ]*$", optional: true, recursive: true} }, maxlength: false }); – lovish goel May 17 '20 at 10:05
  • how to mask input such that user can enter either 5 or 9 digit: – lovish goel May 17 '20 at 10:08

1 Answers1

0
$('.Address, .APT').mask('Z', {
    translation: {
      'Z': { pattern: "^[a-zA-Z0-9_ ]*$", optional: true, recursive: true}
    },
    maxlength: false
  });
  • 1
    Code dumps without any explanation are rarely helpful. Stack Overflow is about learning, not providing snippets to blindly copy and paste. Please [edit] your question and explain how it works better than what the OP provided. – ChrisGPT was on strike May 17 '20 at 12:14