javascript - JS multiple replace -


i have problem.

i don't know how explain it, i'll give example:

i want replace =) bla1, , want replace =)) bla2.

but happens =)) becomes bla1)

what can do?

thanks lot, , sorry english

edit: can't replace =)) first. have more signs this. (>:),:((,:)) , more...). of them in array , use loop replace of them. it'll complicated change of them. array big

first replace more specialized one.

  1. replace =)) bla2
  2. replace =) bla1

example

var text = "this =)) =) demo =)) =) =)) text"; text = text.replace(/=\)\)/g, "bla2"); // =)) text = text.replace(/=\)/g, "bla1"); // =)  // text = bla2 bla1 demo bla2 bla1 bla2 text 

failed example

var text = "this =)) =) demo =)) =) =)) text :))"; text = text.replace(/=\)/g, "bla1"); // =) text = text.replace(/=\)\)/g, "bla2"); // =))  // text = bla1) bla1 demo bla1) bla1 bla1) text  

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -