Reputation: 31
Hello there I just wanted to ask if there is a way to remove all right-to-left characters. I am aware of
.replace(/\u200f/g, "")
and .replace(/[^\x00-\x7F]/g, "")
but they have not really helped with my leaderboards since the former still doesn't remove the rtl characters and the latter only removes all non-ascii characters which also involves characters that aren't written from left to right. if there was a possible fix for replacing all characters from languages that are read from right to left, i would be very grateful
Here is the sample input
acc.tag.replace(/\u200f/g, "")
and here is the sample output
1. PersonA#1333 - 8052.7x
2. PersonB#3169 - 8035.3x
3. PersonC#7619 - 7541x
PersonD#7797 - 7529.5x.𞠔𞠔 4
or when I do .replace(/[^\x00-\x7F]/g, "")
it outputs the following(sample):
4. PersonA#1333 - 8052.7x
5. PersonB#3169 - 8035.3x
6. PersonC#7619 - 7541x
4. #4327 - 6553.4x
in the above scenario, it replaced 𝐁𝐫𝟎𝐰𝐧𝐏𝟑𝐚𝐜𝐡 as "" since it consists of non ASCII characters but its not a rtl text.
Upvotes: 3
Views: 175