View Single Post
 
Old 11-10-2022, 07:47 AM
paulkaye paulkaye is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Nov 2011
Posts: 84
paulkaye is on a distinguished road
Default Using find/replace to insert a word while retaining wildcard-found text

I'm sure this is possible, but I can't figure it out.
I often have a numbered list of items. Not Word-formatted numbering, but rather plain-text numbering, such as

1. An apple
2. A pear
3. Horses
4. Donkey

(I note that the gap between the period and the list item is normally a tab rather than a space.)

I'd like to use find-replace to end up with:

Example 1. An apple
Example 2. A pear
Example 3. Horses
Example 4. Donkey

For reasons that are complicated to explain, I cannot use the paragraph-end mark of the previous item as part of the string to find. For example, finding ^p and replacing it with ^pExample won't work in my situation. Instead, I need to be able to find any number followed by a period, and replace it with the same text, just with the prefix "Example ". My lack of find-replace skills means that I don't know how to tell Word to replace the found number with whatever number was found in each case.

The closest that I came was, with wildcards switched on:
find: ([0-9]{1,}.)
replace: Example \1

but for reasons I simply cannot even imagine, the result is:
Exampl1.e An apple
Exampl2.e A pear
Exampl3.e Horses
Exampl4.e Donkey

Making it even more confusing, is that if I do this:
find: ([0-9]{1,}.)^t
replace: Example \1^t

the result is:
Examp1.le An apple
Examp2.le A pear
Examp3.le Horses
Examp4.le Donkey


If a macro is a better way to go, I'm fine with that, too.
Hope the problem is clear. Any help would be most appreciated!
Reply With Quote