CaioQuirinoMedeiros/react-native-mask-input

Mask an email

jmada opened this issue · 2 comments

jmada commented

Hi everyone!

I have a problem right now trying to create a mask for an email using regex.
This is my regex code:
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i

I'm attempting to transform this:

<MaskInput
...otherProps
mask={['\[A-Z0-9._%+-]\', '@', '\[A-Z0-9.-]\', '.', '\[A-Z]{2,}\']}
/>

However, it isn't working because each item in the mask array should represent the regex for that specific character. In this case, we don't know how many characters will be in each part of the regex.

How can I approach this use case?

Thank you!

@jmada @CaioQuirinoMedeiros @idealamz same issue facing any one can help on this

This is not an issue! Think about it, there's no such thing as email mask