ozgus
ozgus

Reputation: 179

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!

Upvotes: 3

Views: 72

Answers (1)

Sumurai8
Sumurai8

Reputation: 20737

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.

Upvotes: 4

Related Questions