react-input-mask
react-input-mask copied to clipboard
Optional characters
trafficstars
Does this library support optional characters? For instance a US zip code is usually in format 99999 but sometimes can be in format 99999-9999.
I looked at the options and initially thought the charRegex option allowed me to type in my own mask regex, like this:
const { getInputProps: zipCodeInput } = useInputMask({
charRegex: /^\d{5}(?:-\d{4})?$/
});
But upon further looking, it looks like that option only sets the allowable characters.