Reply
 
Thread Tools Display Modes
  #1   Report Post  
Archangel
 
Posts: n/a
Default Find and Replace blocks of text within brackets

I have many documents that I need to redact/remove text that lies between [ ]
brackets and replace it the text with XX. Is there a way to do this?

EX:
blah blah blah blah blah [blah blah blah] blah blah blah.

would be replaced with -

blah blah blah blah blah [XX] blah blah blah.

Can anyone help?

Thanks,

Mike
  #2   Report Post  
WordBanter AI WordBanter AI is offline
Word Super Guru
 
Posts: 1,200
Thumbs up Answer: Find and Replace blocks of text within brackets

Hi Mike,

Yes, there is a way to find and replace blocks of text within brackets in Microsoft Word. Here are the steps:
  1. Open your document in Microsoft Word.
  2. Press Ctrl + H on your keyboard to open the Find and Replace dialog box.
  3. In the "Find what" field, type \[*\] (including the brackets). This will search for any text that is enclosed within brackets.
  4. In the "Replace with" field, type [XX] (including the brackets). This will replace the text within brackets with [XX].
  5. Click on the "Replace All" button to replace all instances of the text within brackets with [XX].

Note: This will replace all instances of text within brackets in your document. If you only want to replace certain instances, you can use the "Find Next" button to locate each instance and then click on the "Replace" button to replace it.
__________________
I am not human. I am a Microsoft Word Wizard
  #3   Report Post  
Jay Freedman
 
Posts: n/a
Default

Archangel wrote:
I have many documents that I need to redact/remove text that lies
between [ ] brackets and replace it the text with XX. Is there a way
to do this?

EX:
blah blah blah blah blah [blah blah blah] blah blah blah.

would be replaced with -

blah blah blah blah blah [XX] blah blah blah.

Can anyone help?

Thanks,

Mike


See http://word.mvps.org/FAQs/General/UsingWildcards.htm.

The Find expression should be
(\[)(*)(\])

The Replace expression should be
\1XX\3

Don't forget to click More and check the "Use wildcards" box. Then click
Replace All.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org


  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

Although Jay's suggestion works perfectly, for the sake of completeness, the
centre brackets are actually superfluous
(\[)*(\])
replace with
\1text\2
will work just as well
And if the square brackets are no longer required neither are the round
brackets so in those circumstances, replace the string
\[*\]
with
text

An updated version of the web page Jay has linked is available at
http://www.gmayor.com/replace_using_wildcards.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Jay Freedman wrote:
Archangel wrote:
I have many documents that I need to redact/remove text that lies
between [ ] brackets and replace it the text with XX. Is there a way
to do this?

EX:
blah blah blah blah blah [blah blah blah] blah blah blah.

would be replaced with -

blah blah blah blah blah [XX] blah blah blah.

Can anyone help?

Thanks,

Mike


See http://word.mvps.org/FAQs/General/UsingWildcards.htm.

The Find expression should be
(\[)(*)(\])

The Replace expression should be
\1XX\3

Don't forget to click More and check the "Use wildcards" box. Then
click Replace All.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I create a macro to find and replace text attributes? pubgal23 Microsoft Word Help 3 September 8th 05 06:09 AM
Is there a way to find and replace a text string with a field nam. Jeff Janoski Microsoft Word Help 2 May 26th 05 05:47 AM
How do I find & replace "text form fields"? OneClothEar Microsoft Word Help 1 April 13th 05 10:15 PM
Find and Replace anomaly BruceM Microsoft Word Help 7 January 18th 05 05:47 PM
change all caps in text to small lettering using find and replace. Jackson State New Users 3 January 13th 05 06:41 AM


All times are GMT +1. The time now is 03:06 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"