Is there a way to use optional characters?
Closed this issue · 2 comments
guiguetz commented
Hello! I'm trying out this lib, and couldn't find in the docs if we can use optional characters on the masks.
For example, here in Brazil we have two kinds of phone number: (00) 00000-0000
and (00) 0000-0000
. Is there a way to use it like in another libs as (00) 90000-0000
so that extra digit becomes optional?
Thanks!
xnimorz commented
Hi @guiguetz
Thank you for the question!
You can use the same code as in the example with credit cards where you have a different flow for VISA and American Express cards.
Code: https://github.com/xnimorz/masked-input/blob/master/examples/maskInput.md#credit-card
View: https://xnimorz.github.io/masked-input/ in the section "Credit card"
guiguetz commented
Nice! Hadn't thought on that, sure will use it!