I'm trying to remove non-Latin characters from a string with Javascript. I'm using the following code:
text.replace(/[\u0250-\ue007f]/g, '')
I first thought it was working fine, until I discovered it also removes the 'f' character from the string. Any suggestions?
You can remove a character from a Python string using replace() or translate(). Both these methods replace a character or string with a given value. If an empty string is specified, the character or string you select is removed from the string without a replacement.
Try this:-
text.replace(/[\u0250-\ue007]/g, '');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With