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?
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?
Share Improve this question edited Nov 28, 2012 at 18:02 dda 6,2032 gold badges27 silver badges35 bronze badges asked Nov 28, 2012 at 14:53 BjornBjorn 9041 gold badge10 silver badges29 bronze badges2 Answers
Reset to default 16Try this:-
text.replace(/[\u0250-\ue007]/g, '');
Oops, I must be tired. After posting and looking at it, I discovered the 'f' at the end of the expression...
So it should be
text.replace(/[\u0250-\ue007]/g, '')