Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript replace seem not working

I think it's just a stupid mistake in my code, but I cant find it. Could you help me?

content = content.replace(/\[\[Kategoria:Dystrykty stanu Tamil Nadu‎/gi, "[[Kategoria:Dystrykty stanu Tamilnadu‎");

seem not to work properly.

[[Kategoria:Dystrykty stanu Tamil Nadu]] -> [[Kategoria:Dystrykty stanu Tamil Nadu]]

should be:

[[Kategoria:Dystrykty stanu Tamil Nadu]] -> [[Kategoria:Dystrykty stanu Tamilnadu]]

It seems to me that regexp is wrong, but I can't tell where and why. Thanks in advance!

like image 700
ozgus Avatar asked Sep 09 '26 07:09

ozgus


1 Answers

There seems to be an invisible character behind Nadu in the first part of your regex. Remove Nadu‎/gi and retype it again and it should work.

Edit: The invisible character is the left-to-right-mark. It is behind the replace-string too.

like image 176
Sumurai8 Avatar answered Sep 10 '26 21:09

Sumurai8



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!