Top
MaskedInput - Defining masks
MaskedInput
To define a mask you can use the following characters:
  • 0 - Digit. Accepts any digit between 0 and 9.
  • 9 - Digit or Space. Accepts any digit between 0 and 9, or a space.
  • # - Digit or Space. Accepts any digit between 0 and 9, or a space, and also (+) and (-) signs.
  • L - Letter. Restricts input to letters a-z and A-Z. This rule is equivalent to [a-zA-Z] in regular expressions.
  • ? - Letter or Space. Restricts input to letters a-z and A-Z, and space. This rule is equivalent to [a-zA-Z] in regular expressions.
  • & - Character. Accepts any character. The rule is equivalent to \S in regular expressions.
  • C - Character or Space. Accepts any character. The rule is equivalent to . in regular expressions.
  • A - Alphanumeric. Accepts letters and digits only.
  • a - Alphanumeric or Space. Accepts letters, digits and space only.
We can declare a new rule for a new character, like x, containing only numbers 4 and 5:
The maskDefinitions prop allows you to register new rules that can be used in the mask strings. Also, it allows overwriting existing rules.