0

I'm using the masked input plugin to mask some zip code input fields. This works great for most circumstances, however I can't figure out how to mask a UK postcode.

the problem arises because the UK pestcode has a spot that can have 1 or 2 digits. for example:

1x  1xx
1xx 1xx

the first example has one letter x in the first 3 digits, but the second has two letter x. I know how to use masked input to specify that I need at least 3 digits, but the rest are optional:

$('element').mask('***?***'); 

//* is for accepting alpha-numeric
//the above says 'I need at least 3 digits, the rest are optional'

however, how do I make an optional in the middle of the mask? and the rest are required?

also, does masked input accept regex?

Abdul Ahmad
  • 9,673
  • 16
  • 64
  • 127

0 Answers0