var text = "'Hello'World'''";
how to replace all '
and Hello
and World
to '
result = "'''''''"
var text = "'Hello'World'''";
how to replace all '
and Hello
and World
to '
result = "'''''''"
text.replace(/'|Hello|World/g, "'")
The g
is for global, it wont stop at the first match but continue matching as many times as possible.