How to Replace Outer Parentheses with Square Brackets in Word
Question details
The user needs to change the outermost parentheses to square brackets around a text string while leaving any nested inner parentheses unchanged.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Formatting a document that contains nested sets of parentheses where only the outer set should be converted.
- Observed behavior
- The goal is to specifically target and replace the outer brackets, transforming text like '(text (text) text)' into '[text (text) text]'.
Before applying complex wildcard replacements, review your text structure to ensure that the spacing, punctuation, and parenthesis depth are consistent across the sections you want to modify.
Use Advanced Wildcard Search and Replace
Utilize Word's wildcard feature to capture distinct text groups and specifically target only the outer parentheses for replacement.
By enabling wildcards, you can use capture groups to define the structure of your nested text. This instructs the word processor to capture the text before the inner parentheses, the inner text itself, and the text after, and then output them wrapped in square brackets.
Press Ctrl+H on your keyboard to open the Find and Replace dialog box.
Click the 'More >>' button to expand search options, and check the box for 'Use wildcards'.
In the 'Find what' box, type a wildcard pattern that captures the three sections inside the outer parentheses. A basic structure looks like \((*) \((*)\) (*)\) which separates the elements into three capture groups.
In the 'Replace with' box, type [\1(\2)\3]. The numbers correspond to your capture groups, inserting square brackets on the outside while keeping the inner parentheses intact.
Click 'Find Next' and then 'Replace' to test the first instance. If the formatting is correct, click 'Replace All' to apply the changes throughout the document.

Use a VBA Macro for Complex Nested Parentheses
For highly complex documents where wildcards might be inconsistent or too greedy, a VBA macro provides precise programmatic control.
Easily Perform Advanced Wildcard Replacements in WPS Writer
WPS Writer provides comprehensive support for advanced Find and Replace functions, including wildcard capturing, making it incredibly simple to manage complex text formatting and nested brackets.
- 1. Open Your Document: Launch WPS Writer and open the document containing the nested parentheses.
- 2. Access Find and Replace: Navigate to the Home tab and click on 'Find and Replace', or simply press Ctrl+H.
- 3. Turn on Wildcards: Click the 'Options' button in the dialog and check the 'Use wildcards' box.
- 4. Apply Replacements: Enter your specific capture groups in the Find box and your bracket replacement syntax in the Replace box, then hit 'Replace All'.

Frequently Asked Questions
Why is my wildcard search replacing more text than intended?
Wildcard characters like the asterisk (*) can be 'greedy', meaning they will capture as much text as possible until the next matching character. To fix this, restrict your search by using explicit character ranges like [a-zA-Z0-9 ] to accurately define the scope.
How do I search for a literal parenthesis when wildcards are enabled?
To search for an actual parenthesis character in wildcard mode, you must 'escape' it by typing a backslash before it, such as \( or \). Without the backslash, the word processor treats parentheses as the boundaries for capture groups.
Can I replace paragraph marks while using wildcards?
Yes, but you cannot use the standard ^p code when wildcards are active. Instead, you must use the ANSI character code ^13 to successfully locate and replace paragraph breaks within a wildcard search.




