Is it possible to bulk replace all instances of the carbon dioxide molecule notation CO2 with the proper notation (subscript 2)?
As of 2024, it’s “Find All”, and it’s a PITA that LO still isn’t able to search+replace all on its own.
It’s perfectly able - if you properly search for the 2
- using a regex like (?<=CO)2
, which doesn’t select the CO
, and uses them only as a condition (“assertion”) for the 2
.
Also, the suggestion of @LeroyG works just as well - not requiring to apply any direct formatting.
Thanks for the info + screencast. Using the regex + “₂” did the job, although I still think the dialog should make it possible to simply search for “CO2” and support sub/superscript in the Replace section since most users don’t know regexes.
Yes, you can.
Find “CO2”
Mark “Current selection only”
Find “2”
Click Find All
Apply sub/superscript.
Open the full Search&Replace tool (Ctrl
H
) and enable “Regular expressions” under “other options.” In “Find” write
(?<=CO)2
and click “select all:” all the “2” after a CO will be selected. Alt
Tab
to go to the document and now you can apply the formatting to all those “2” either as direct formatting (Ctrl
Shift
B
) or by applying a character style.
…and Replace all: with ₂
.