CaioQuirinoMedeiros / react-native-mask-input

🎭:iphone: A simple and effective Text Input with mask for ReactNative on iOS and Android. Includes obfuscation characters feature.
https://www.npmjs.com/package/react-native-mask-input
MIT License
309 stars 31 forks source link

Mask an email #43

Closed jmada closed 1 year ago

jmada commented 1 year ago

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!

codal-mpawar commented 1 year ago

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

CaioQuirinoMedeiros commented 1 year ago

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