Find replace a search term by partially formatted text?

I wonder if it’s possible to bulk replace the non-formatted formula for carbon dioxide with the formatted one (subscript 2).
Something tells me it’s impossible to replace search terms only formatting a part of them (in this case ‘2’ > subscript 2).

I guess I have to restrict the search term to just ‘2’ and walk through all instances of ‘2’ through the ‘next’ button, replacing the 2’s at each found instance of ‘CO2’?

In this specific case, just use Unicode Character ‘SUBSCRIPT TWO’ (U+2082) as the replacement.

Actually, the problem here is to create a correct regular expression that would have only the “2” as the search result, and everything else just as (negative)? look-ahead/behind assertions. Like (?<=\bCO)2\b.

You can select all the “2” after CO with the help of Regular Expressions.

On the full S&R tool (Ctrl H) check “regular expressions” under “more options” and search for

(?<=CO)2

This expression will only pick the “2”, ignoring the CO or any other combination with a “2” on it. Then you can either format the 2 as suffix or replace it by ₂ as @mikekaganski suggest.