<TextInput value={initialMoney} onChangeText={(x) => { setInitialMoney(x.replace(/\B(?=(\d{3})+(?!\d))/g, '.')); }} />
The above code will not work properly.
instead of showing 214.124.124.124
It will show 2.1.4.1.2.4.1.2.4.123
No problem with regex, I tried regex outside of TextInput and it worked fine. Can anyone help me solve this problem?
There may be some problems with your regular expression. Trying to debug it, I checked via Regex101 and it showed the error.
Try reading this articleHow to format numbers to currency when using React Native Expo?
Hope this helps.