We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

how to use search & replace to make superscripts? [closed]

asked 2017-10-07 04:32:52 +0200

catbill gravatar image

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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-10-16 23:23:45.251329

2 Answers

Sort by » oldest newest most voted

answered 2017-10-07 08:56:53 +0200

RGB-es gravatar image

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 :)

edit flag offensive delete link more

answered 2017-10-07 06:03:43 +0200

robleyd gravatar image

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 ✔ 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.

edit flag offensive delete link more


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?

catbill gravatar imagecatbill ( 2017-10-07 06:20:28 +0200 )edit

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.

robleyd gravatar imagerobleyd ( 2017-10-07 07:18:09 +0200 )edit

Question Tools

1 follower


Asked: 2017-10-07 04:32:52 +0200

Seen: 818 times

Last updated: Oct 07 '17