Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2022, 07:47 AM
paulkaye paulkaye is offline Using find/replace to insert a word while retaining wildcard-found text Windows 10 Using find/replace to insert a word while retaining wildcard-found text Office 2016
Advanced Beginner
Using find/replace to insert a word while retaining wildcard-found text
 
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
  #2  
Old 11-10-2022, 12:32 PM
Robert2 Robert2 is offline Using find/replace to insert a word while retaining wildcard-found text Windows 10 Using find/replace to insert a word while retaining wildcard-found text Office 2007
Competent Performer
 
Join Date: Jun 2013
Posts: 165
Robert2 will become famous soon enoughRobert2 will become famous soon enough
Default

Try the following wildcard Find/Replace:
Find=[0-9]{1,}\.
Replace=Example ^&
Reply With Quote
  #3  
Old 11-13-2022, 03:17 AM
paulkaye paulkaye is offline Using find/replace to insert a word while retaining wildcard-found text Windows 10 Using find/replace to insert a word while retaining wildcard-found text Office 2016
Advanced Beginner
Using find/replace to insert a word while retaining wildcard-found text
 
Join Date: Nov 2011
Posts: 84
paulkaye is on a distinguished road
Default

Robert2 - thank you for your help. Interestingly, your strings resulted in exactly the same as my first version, e.g.: "Exampl1.e An apple". Because I expect you know what you're talking about, I figured that something fundamental must be wrong at my end. And I've figured out the culprit - it's track changes. Both your version and mine work fine when track changes is OFF. Track changes causes this problem whether or not deletions are shown or hidden. I can't figure out why track changes would cause this problem, but it's solved, so thank you for taking the time to help.

-Paul
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wildcard find/replace wildcard question hephalumph Word 1 03-12-2022 12:54 AM
Need Help With Find and Replace Wildcard rsrasc Word VBA 9 10-13-2015 02:37 PM
Using find/replace to insert a word while retaining wildcard-found text Find-replace using part of what was found in the replacement text paulkaye Word 3 12-22-2014 02:52 AM
Using find/replace to insert a word while retaining wildcard-found text Need help using WildCard Find & Replace Cayce Word 1 06-09-2014 04:17 PM
Using find/replace to insert a word while retaining wildcard-found text Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft