I want to replace all {0} on a string with x. It should not match {{0}}.
How can I do it?
I want to replace all {0} on a string with x. It should not match {{0}}.
How can I do it?
Match either {{0}} or {0}, and replace only those occurances that are {0}.
Something like:
s = s.replace(/(\{\{0\}\}|\{0\})/g, function(m){ return m == '{0}' ? 'x' : m});