Find and Replace to add Subscript

Is it possible to do a blanket find and replace in a document? I use CO2 for carbon dioxide dozens of times in my book, but would like to change it to CO with a 2 subscript. I sense I’m missing something obvious.

Thanks,
Bob
(Scrivener 3 Mac)

There is a global text search and replace with Edit ▸ Find ▸ Project Replace…, but it only operates on text, not formatting.

One thing to consider is that some fonts have sets of super and subscripted letters and numbers built into them. They would be found within the “Superscripts and Subscripts” section of the Unicode table. In this particular case, you could use the “Subscript Two” character (U+2082), like this “CO₂”. I’d run that through a few compile tests with the intended output format and font and make sure it works—but if it does that will often give you a better looking result anyway, particularly in fonts where these optional characters have been designed by hand for that size and placement.

You may hate the suggestion, but since I always compile to Word format after composing in Scrivener, I just use Word to do the Find/Replace:

  1. Use Find/Replace to change instances of “CO2” to (e.g.) “CO2
  2. Then use Find/Replace again (this time using Word’s Advanced Find & Replace) to change all instances of “2” to a subscript “2”.