2 Ways to Batch Delete Brackets and Inside Spaces in Your Word Document

In this article bellow, we will offer you 2 ways to batch delete brackets and the inside spaces in your Word document. 

Now and then, people like to use brackets to mark words out of all kinds of purposes. Yet, after a while, you may decide to remove all brackets but only to find there are so many of them, scattering around your document. Honestly, it can take forever to delete them one by one. What’s more, out of some special need, you may have to remove all the spaces between a pair of brackets as well.Batch Delete Brackets and Inside Spaces in Your Word Document

This is why you will need to read this article to equip yourself with more practical solutions.

Method 1: Use Wildcards in “Advanced Find” Command

  1. First of all, click “Home” tab and click the drop-down button on “Find” command.
  2. Next choose “Advanced Find” on the drop-down menu to open “Find and Replace” dialog box.Click "Home"->Click Arrow Button on "Find" Button->Choose "Advanced Find"
  3. For example, if you want to find all square brackets, enter “\[*\]”(without quotation marks) in “Find what” text box.
  4. Next click “More” button to bring out more options.
  5. Check “Use wildcards” box.
  6. Then click “Find In” tab and choose “Main Document”. You will see all square brackets and the enclosed texts are in selection, such as bellow:Enter Strings in "Find what" Text Box->Check "Use wildcards" Box->Click "Find In" Button->Choose "Main Document"
  7. Now clear “Find what” text box and enter “[[\] ]”(without quotation marks).
  8. Click “Find In” and this time choose “Current Selection”. You will find all square brackets and all spaces inside are in selection as follows:Enter Strings in "Find what" Text Box->Click "Find In" Button->Choose "Current Selection"
  9. Press “Delete” to get rid of square brackets and all spaces inside.
  10. However, if you want to keep spaces, just replace the strings in step 7 with “[[\]]”.Effect of Selecting Square Brackets Only

There are several sorts of commonly used delimiters in the bellowing table, together with the strings to find them or the inside spaces.

Brackets Strings to Find Brackets and All Enclosed Texts Strings to Find Brackets and All Spaces Inside Strings to Find Brackets Only
Square Brackets

[ ]

\[*\] [[\] ] [[\]]

( )

\(*\) [(\) ] [(\)]
Braces (Curly Brackets)

{ }

\{*\} [{\} ] [{\}]
Angle Brackets

< >

\<*\> [<\> ] [<\>]

Method 2: Run VBA Codes

  1. Firstly, press “Alt+ F11” to open VBA editor.
  2. Next click “Normal” and then “Insert” tab.
  3. Choose “Module”.Click "Normal"->Click "Insert"->Click "Module"
  4. Then double click on to open it.
  5. And paste the following codes there:
Sub DeleteDelimiters(objFind As Find, strLeftDelimiter As String, strRightDelimiter As String, bDeleteSpace As Boolean)
  Dim strFind1 As String
  Dim strFind2 As String
  strFind1 = "\" & strLeftDelimiter & "*\" & strRightDelimiter
  If (bDeleteSpace) Then
    strFind2 = "[" & strLeftDelimiter & "\" & strRightDelimiter & " ]"
    strFind2 = "[" & strLeftDelimiter & "\" & strRightDelimiter & "]"
  End If
  Selection.HomeKey Unit:=wdStory
  objFind.Replacement.Text = ""
  While objFind.Execute(FindText:=strFind1, MatchWildcards:=True)
    objFind.Execute FindText:=strFind2, MatchWildcards:=True, _
      ReplaceWith:="", Replace:=wdReplaceAll, Wrap:=wdFindStop

End Sub

Sub DeleteBracketsAndSpace()
  Application.ScreenUpdating = False
  '  Delet all square brackets and the space in it.
  Call DeleteDelimiters(Selection.Find, "[", "]", True)
  '  Delet all parenthesis and the space in it.
  Call DeleteDelimiters(Selection.Find, "(", ")", True)
  '  Delet all braces and the space in it.
  Call DeleteDelimiters(Selection.Find, "{", "}", True)
  '  Delet all angle brackets and the space in it.
  Call DeleteDelimiters(Selection.Find, "<", ">", Ture)
  Application.ScreenUpdating = True
End Sub
  1. Now, in macro “DeleteBracketsAndSpace”, keep just the lines you need to delete the brackets you have in your document and remove all unneeded code lines.

If you want to get rid of brackets only, you need to alter the codes a little bit. Let’s say there are square brackets in your document. Then go to line “Call DeleteDelimiters(Selection.Find, “[“, “]”, True)”, and change the “True” to “False”.

  1. Finally, click “Run”.Paste Codes->Click "Run"

Solve Word Issues

To be honest, Word is really capable of a lot of tasks. Yet, it’s not flawless after all. When there is an issue occurring, the outcome can be devastating. Therefore, we can never overlook whatever small problems in Word, since it can lead you to a dead Word with corrupt docx files. The best solution is to get an advanced repairing tool to recover your Word documents.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx repair and pdf repair software products. For more information visit www.datanumen.com

6 responses to “2 Ways to Batch Delete Brackets and Inside Spaces in Your Word Document”

  1. مرسی هرچی از copilot یا همون هوش مصنوعی کمک گرفتم به جایی نرسیدم واسه همین خیلی سپاسگذاریم و آرزوی موفقیت براتون میکنم

  2. Very good. Can you tell us how the numbers in the bracket can be superscripted simulatneously, while removing the brackets?? It will be a lot of help.

Leave a Reply

Your email address will not be published. Required fields are marked *