MS Word is a powerful word processing tool from Microsoft. At times we find ourselves in a situation wherein we need to find and replace numbers in a Word document. It is quite easy to accomplish this using Find and Replace facility given in MS-Word. Here is how we can do this.
Open the document where replacement is to be done.
Press CTRL + H keys to bring Find and Replace box up.
Now, in Find what box type ([0-9])
MS Word: Find and Replace Numbers, Digits, Numerals
Click on More >> button to reveal more options for Find and Replace.
In the extended box, select Use wildcards
Now press Find button and MS Word will find you the first number (i.e. any digit from 0 to 9) in the document. Please note that it will find each digit individually, that is to say that if 2012 is written in the document –this search will find four digits and not 2012 as a whole number.
Our tips on MS-Word make your life easier and increase your productivity at work.
It is very important that you select Use wildcards because this will enable MS Word to understand your search demand.
If you want to delete all the numbers from your document, just keep the “Replace with” box empty and click “Replace all”… this action will effectively replace every numerical digit with nothing.
SEE ALSO: How to Replace Images in MS Word
If you want to replace only certain digits, you can alter the search query. For example, if you want to find only 4, 7 and 9 you should write the following in “Find what” box:
([4,7,9])
If you want to look only for digits from 1 to 4, you can use either of the following expression:
([1,2,3,4])
Or
([1-4])
In the “Replace with” box, you can write whatever you want to replace the found text with. Easy!
So, this was the solution. I hope it was useful! You can see a lot of other MS Word Tips on TechWelkin.
Please feel free to post your questions, if case you have any, in the comments on this article. Thank you for using TechWelkin.
For this one, you could also do a wildcard Find and Replace in Word.
In «Find what», enter: .2[34][0-9]{2}[!0-9]
That will find a full stop (a.k.a. period or dot), followed by 2
, which must then be followed by a 3
or 4
, which is then followed by two (2) digits, and is followed by a character that is not another digit.
That limits it to 2300 to 2499 (so omits the 2500 – but you could do a one-off search for that). By including the not 0-9 at the end, it won’t pick up 23000 or 23456, for example.
Ensure you have clicked the «More» button so you can see all the options.
Tick «Use wildcards».
For «Replace with», leave it blank, but on the Format button at bottom left click Highlight (so under your «Replace with» textbox you’ll now see the word «Highlight»).
(Before you do this, ensure you have highlighted some text with a colour so your highlighter is set to a colour, and not no colour, otherwise your replace won’t «highlight»).
Using Microsoft Word 2013, how do I highlight all numbers in a certain range.
I already found out how to find and highlight all of a certain number, but this would be a big help.
Example: I want to find all numbers between 2300 and 2500 and highlight them. Each number however might be *.2300 *.2301 etc.
Worst case senario, highlighting just any number in a range is the ultimate question, a prefix of *. is only a plus.
update to question:
Note: To state exactly what I am doing — I have a document where a netstat was run on about 100 different machines. the numbers are mixed up with tons of other information. Copying and pasting the numbers to another program would take as much time as highlighting the numbers myself with the highlight tool. Thank you all for your answers so far and I appreciate the advise. I am starting to think the answer may be «No» in word and «Yes» in another program.
In the comments on my post on using wildcards to replace and reformat text inside square brackets, Simon J asked what he’d need to use to find all numbers inside brackets.
I can think of a scenario where I’d want to do what Simon is asking—some of my authors, usually from an engineering background, will write out a number in full then put the numeral in brackets after the word (e.g. seventeen (17) joists, five (5) days). I usually delete one of these when I’m editing, as there’s typically no reason to have both.
Find what field:
- To find numbers inside square brackets, make sure Use wildcards is on, then type this in the Find what field: [[0-9]{1,10}]
- To find numbers inside parentheses (round brackets), make sure Use wildcards is on, then type this in the Find what field: ([0-9]{1,10})
Replace with field:
- To replace what you found with nothing (i.e. delete all such occurrences), then leave the Replace field empty. Note: You may end up with double spaces (the spaces either side of the deleted bracketed number string), so do a standard find and replace to replace them with a single space.
- To replace what you found with something else, then add that to the Replace field.
Notes and warnings:
- This method only finds WHOLE numbers. Numbers with anything else in them (letters or any sort of punctuation, such as decimal points, any sort of hyphen or dash, commas as thousand separators, percent symbols etc.) will NOT be found.
- You can change the parameters of the search string—the example above looks for one to ten consecutive numerals inside the brackets (this is the {1,10} bit). If you wanted different parameters, then you can change these values. For example, {2,5} would look for any whole numbers with 2, 3, 4, or 5 numerals (it would ignore single numbers and numbers with 6 or more numerals), and {1,} would look for numbers of any length from single-digit numbers through to an unlimited string of numbers.
- This method does not allow you to replace just parts of the found string with other characters. For that you would need to surround each element in parentheses. For the first example, you’d use ([)([0-9]{1,10})(]), and for the second you’d normally use ([(])([0-9]{1,10})([)]), (Hint: Copy this string—there are lot of punctuation marks in here that you could get wrong if you try to type is out).
[Links last checked January 2020]
07-19-2014, 01:25 PM |
|||
|
|||
I also would like to unite the paragraphs above and bellow the page number if the paragraph from bellow starts with a low cap, or point, or ! , ? etc…. |
07-21-2014, 11:08 PM |
|||
|
|||
Can you post some examples of both cases? |
07-22-2014, 02:30 AM |
|||
|
|||
Sorry, I didn’t explained it well. Example of the second case: After a shocked pause for a couple of years, one of the What I want is to delete all numbers in such case ^ (numbers that are a paragraph on their own, not within a a paragraph with text) , and unite the upper and lower paragraph IF the lower paragraph starts with low cap. |
07-22-2014, 02:59 AM |
|||
|
|||
Try using the following wildcard Find/Replace: |
07-22-2014, 03:42 AM |
|||
|
|||
Have you tried actually running the replace operation? It should be OK. Word will select the characters preceding the first paragraph end mark, but they will be replaced with themselves, i.e. they won�t be removed (this is done through �1� in the Replace With box). I successfully tested this wildcard pattern in Word 2007 on the sentence you gave as example. Note that you can always undo any replace operation through �Ctrl+Z�. Also note that depending on your system locale and the active list separator, the semi-colons within curly brackets {1;3} might have to be replaced with a simple comma {1,3}. |
07-22-2014, 04:25 AM |
|||
|
|||
You could try using this simpler pattern: |
07-22-2014, 07:55 AM |
|||
|
|||
Thanks, the first one worked exactly like you said. |