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?
尝试这个:-
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, '')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.