I want to replace all {0}
on a string with x
. It should not match {{0}}
.
How can I do it?
Choose Find/Replace (CTRL-H). Use 0 for Find what and leave the Replace with field blank (see below). Check “Match entire cell contents” or Excel will replace every zero, even the ones within values.
Under Display options for this worksheet, select a worksheet, and then do one of the following: To display zero (0) values in cells, check the Show a zero in cells that have zero value check box. To display zero (0) values as blank cells, uncheck the Show a zero in cells that have zero value check box.
Step 1: Select the range that you will work with. Step 2: Press the F5 key to open the Go To dialog box. Step 3: Click the Special button, and it opens the Go to Special dialog box. Step 6: Now just enter 0 or any other value that you need to replace the errors, and press Ctrl + Enter keys.
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});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With