I would like to replace all ONLY single equal signs.
var mystr = 'ONE == TWO ... THREE==FOUR ... FIVE = SIX ... SEVEN=EIGHT' ... NINE := TEN;
return mystr.replace(/(?=\=)([=]{1})(?!\=)/gm, '==');
I get the following:
ONE === TWO ... THREE===FOUR ... FIVE == SIX ... SEVEN==EIGHT ... NINE :== TEN
Numbers 5-6, 7-8, are ok. But, I would like this:
ONE == TWO ... THREE==FOUR ... FIVE == SIX ... SEVEN==EIGHT ... NINE := TEN
Whats wrong with my regex?

:. So, how could it possibly know not to duplicate the last=character? (Hint: since JavaScript doesn't have lookbehind assertions this is pretty tricky... the easiest way would be a second pass to replace:==with:=.)([=]{1})is the same as([=])is the same as(=)(parenthesis are not even needed here). Don't make it overly complicated.