sanniassin / react-input-mask

Input masking component for React. Made with attention to UX.
MIT License
2.24k stars 255 forks source link

Regex with length quantifiers does not work #256

Open Lemonaut opened 3 years ago

Lemonaut commented 3 years ago

I'm trying to use a regex that looks something like this

mask={[/\d{4}-\d{3}-\d{2}-[A-Z]/]}`

I'm able to pass masks like "999-999-a" and [/\d/, /\d/] just fine, however when setting length quantifiers {4} it prevents me from being able to interact with the input. I would simply use "9999-999-99-a" but the last character must be uppercase. It would be nice if "99-A" enforced that. Is there an alternate way of accomplishing this?