sanniassin / react-input-mask

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

Any length of letters? #231

Open 3runoDesign opened 4 years ago

3runoDesign commented 4 years ago

How to just filter anything except letters and set ANY length?

mask= "a" - Only one letter mask = "aaaaaaaaaa" - Only ten letters etc

Is it possible to set any length of letters?

Something like: ^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ0-9]+$ Thank you!

marciogurka commented 3 years ago

I have the same doubt, anything new about this???

vovasapsay commented 3 years ago

<MaskedInput mask={Array.from({ length: 43 }, () => /^[А-я-і-ї-І-Ї-0-9 .']$/)} maskPlaceholder="" /> It's work for me

gbgdev commented 3 years ago

Thanks for the replies, but I think none of them are really answering the question. The original question is if there is a way to require only letters without having to set strict length set to the mask. Like in the regex below:

^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ0-9]+$

Defining long-length masks as a way to support multiple lengths is a workaround.

I have the same question, but from I've been reading upon I am afraid this library doesn't support dynamic lengths 😞