Find and Replace Random Strings

Hi all,

I'm trying to find and replace a bunch of strings in a Word doc. The strings vary but are all CAPS and all contain a paragraph mark before the string and at the end of the string. The strings are like this:

DUTCH COUNTRY BEAN SOUP
SPLIT PEA SOUP
EGG BALLS FOR SOUP

Is there some way to use wildcards like (^13)([A-Z]{n})(^13) in the Find What box but replace "n" with a variable that will find all uppercase strings even with spaces between words?

And then what would I put in the Replace box to preserve all of text?

Use


^13[A-Z ]{1,}^13


There is a space after the Z before the ]


You have not told us what you want to replace the string or part of it with so cannot help on the last question.

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Doug,

I want to keep the text but bold change the formatting to bold.

So I used your magic wildcards and just modified them like so:

(^13)([A-Z ]{1,})(^13)

and put \1\2\3 in the Replace box with Bold font formatting for that box.

Thanks!

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If you want to use all of the found string, one set of parenthesis is all that you need.


(^13[A-Z ]{1,}^13)

and then

\1

in the Replace with box.
Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If you want to use all of the found string, one set of parenthesis is all that you need.


(^13[A-Z ]{1,}^13)

and then

\1

in the Replace with box.


Actually, if you want to use all of the found string, no parentheses are needed!
Find = ^13[A-Z ]{1,}^13

Replace = ^&

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated December 31, 2022 Views 979 Applies to: