How to use search & replace to make superscripts?

I am editing a document and want to change numbers used in scientific notation to superscript. For example, I would like to make all occurences of -5 appear as superscripts. There must be a way to use search and replace to change all -5s, then all -6s, etc. I just don’t want to make each change individually.

In the search and replace window, there is a superscript option. However, it searches for superscripts. I don’t want it to do that but rather to change normal numbers to superscripts. What am I missing?

Search for the value you want to change using Find all - once found the values will be selected and you can apply a pre-existing style, or use Format | Character to change the selections to superscript.

If this answer helped you, please accept it by clicking the check mark :heavy_check_mark: to the left and, karma permitting, upvote it. If this resolves your problem, close the question, that will help other people with the same question.

Thank you, robleyd. I should have thought about that. It would often work just fine but sometimes I may want to make changes on a case-by-case basis. Any way to do that?

If by case-by-case you mean some but not all of the e.g. -5 then unless there is an additional search parameter that will identify the cases - for example followed by a full stop - then you’ll need to do them individually.

And remember you can use regular expressions to find.

You can use some RegExp magic.

Let’s assume you are searching for something like 10-5 or 10-77 but not 11-2 or 10 - 7 (notice the space), and you want to select the negative exponents only to raise them. Open the full search-replace tool with Ctrl H → More options → check Regular expressions. On the Search box type something like


This is a “look-behind expression” that search for a “minus” (here a dash, if your text have real “minus signs” --U+2212-- you’ll need to change the expression accordingly) and one or more digits that follows a zero, but without selecting the zero. Of course it will be quite difficult to find positive exponents without messing up proper numbers, but at least you have something :slight_smile: