vendredi 20 mars 2015

javascript string.replace $1 if it is a certain value?

Is there some way to check the value of $1 and if it is equal to "left" then replace with "newleft"?


Something like this: str.replace(re, 'Blah blah $2, $1="left" ? "newleft": "something" ');


Aucun commentaire:

Enregistrer un commentaire