Word: Replace and reformat text inside square brackets using wildcards

June 20, 2011

My husband wanted to select a long column of text and find any text that was inside square brackets and reformat it so that the text — and the square brackets — was 4 pt and blue (no, I don’t know why either…).

This is an ideal job for using wildcards in Word’s find and replace. However, square brackets are special characters in wildcard searches, so they have to be treated differently. With some help from http://word.mvps.org/faqs/general/usingwildcards.htm and a bit of trial and error, I figured it out. I explain what all the settings mean after these steps, if you’re interested. Meantime, here’s my solution, which works in all versions of Word:

  1. Select the text you want to change (e.g. entire document, selected paragraphs, selected columns or rows of a table).
  2. Press Ctrl+H to open the Find and Replace dialog box.
  3. Click the More button.
  4. Select the Use wildcards check box.
  5. Put your cursor into the Find what field.
  6. Type the following exactly (or copy it from here): (\[)(*)(\])
  7. Go to the Replace with field and type: \1\2\3
  8. Click the Format button, and select Font.
  9. On the Font dialog box change the settings to what you want — in my husband’s case, this was 4 pt and blue — then click OK. Your Find and Replace dialog box should now look like this:

    Find and reformat text inside square brackets

    Find and reformat text inside square brackets

  10. Click Replace All.
  11. Once all replacements have been made, check that you got what you expected before making further changes to the document. If it’s all OK, save your document with the new changes.

What it all means

The three elements of the Find are:

  1. (\[) — You need to find a specific character (the opening square bracket), so you need to enclose it in parentheses. However, because the square brackets are special wildcard characters in their own right, you need to tell Word to treat them as normal text characters and not as special characters, so you put in a backslash ‘\‘ (also known as an ‘escape’ character) before the [.
  2. (*) — This tells Word to look for any characters after the opening square bracket. There’s no limit on what sort of characters (alpha, numeric, or symbols) Word is to find, or on how many there are.
  3. (\]) — This tells Word to stop the find at the first closing square bracket it finds after an opening square bracket followed by any other characters. As with the opening square bracket (1. above), the closing square bracket is a special wildcard character, so needs a backslash in front of it for Word to treat it as ordinary text, and it needs to be enclosed in parentheses as it’s an exact match you want.

There are no spaces between any of these elements — the aim is to find a string such as [green frog] and replace it with exactly the same text but formatted in a different color and with a difference font size.

The three elements of the Replace are:

  1. \1 — Tells Word to replace the first element of the Find with what was in the Find (the opening square bracket).
  2. \2 — Tells Word to replace the second element of the Find with the same text as what was found. In other words, keep the exact text as was found, but change it’s font size and color.
  3. \3 — Tells Word to replace the third element of the Find with what was in the Find (the closing square bracket).

As with the Find elements, there are no spaces between these elements. You still want [green frog], not [ green frog ].

See also:

[Links last checked June 2011]


  1. I’m very sorry, but the wildcard searchstring “(\[)(*)(\])” isn’t valid in Word 2007. It should be “\((*)\)”, so no brackets around “\(” and “\)”.


    The Netherlands

  2. Same here – doesn’t work in Word 2003 either. For some reason no matter what I do, it won’t find the square bracket character.

  3. Hi KT

    I just tested it again in Word 2003 and it worked fine for me. I didn’t try to type the find or replace strings — I just copied them from steps 6 and 7 on this page and pasted them into their respective fields on the Find and Replace dialog box.

    Make sure you have ‘Use wildcards’ checked too (Step 4) otherwise it won’t work.


  4. Hi KT

    One other thing… Make sure that when you select the font color etc. for the replace action, that your cursor is in the ‘Replace with’ field. In my testing just now, I inadvertently left it in the ‘Find what’ field and of course, no replacements could be made as there was nothing in the document with the font/size I wanted!

    An easy error to make as I think Word wants to apply the font formatting to the ‘Find what’ field by default and you have to explicitly put your cursor in the ‘Replace with’ field to make it happen.


  5. Hi Wim

    I just tested my original solution in Word 2007 and it worked fine. See possible reasons for it not to work in my answer to KT (above).


  6. I tried the search string again and now it worked!

    I guess I was a little bit too quick in my response.

    Sorry about that!

    FYI: Here’s another way to get the same result: \[(*)\] and replace with [\1].

  7. It Worked!! Actually both of these worked:

    Find: (\[)*(\])
    Replace: ^& (means replace with contents that was Found


    Find: \[(*)\]
    Replace: [\1]

    I actually think (since I’m sure I tried the first one before I posted the first time (I tried EVERYTHING!) that I may have put the “formatting” on the Find instead of the Replace as Rhonda said. :-\ Can’t think of why else it wouldn’t have worked.

    Oh well. :-D I’m all set now! Thank goodness and thanks for all your help!!

  8. Hello, Thanks you for such a useful page.
    I am trying to clean up the text from an old book which I got from the Gutenberg Project. It has hundreds of sets of square brackets containing numbers, which are there for references. I wanted to delete them, but couldn’t figure out how to do this.
    I simply cut the symbols from line 6 of your tutorial and replaced each set of brackets containing numerals with nothing. It worked wonderfully.
    Thanks once again.
    Regards from Australia.

  9. Thank you!! Worked like a charm for me in Word 2003. I was trying to globally style a variety of words found within and just replaced the [ ] above with .

  10. Not sure what happened to my comment above, but the less-than and more-than brackets in my note disappeared. They were the characters I had to search for:

  11. Hi Faith

    I don’t know what happened to your ‘arrow’ brackets, but two possibilities spring to mind — did you check the Use Wildcards box, and did you enclose what you were looking for in round brackets?


  12. You can even Find & Replace Multiple Words in Multiple Word files using simple software.


  13. Rock on! thank you so much!

  14. Works fine in 2007 thank you. You just need to select “use wildcards” and away you go. Worked as you said so thank you!

  15. This worked well for me in Word 2007. I have uncovered a strange glitch though. I’m using this as a work around to help Excel maintain source formating when using data for a print merge. Since excel won’t keep the original formatting I am using this to put brackets around blank records adding a red font and changing the characters to hidden on unfinished data. This allows meto print the work in progress without the holes from all the unfinished data. The problem is that word puts a section break in between the brackets which signal a new page so there are empty spaces were the unfinished cells are. If I change the section break to continuous then I lose the data merged into my header. Is there something about the formula that I can change so it won’t do this?

  16. Hi Diane

    I’ve never tried what you’re doing, so I’m not sure what’s going wrong. A section break in Word is indicated by ^b in the Replace field — do you have one of those in there?


  17. No ^b in the Replace field. I figured out that when word completed the print merge it would place a section break at the end of each page. I’m not exactly sure why. But I did a search and removed all section breaks after the merge was completed and now your formula works brilliantly.

    This really is a terrific work around for highlighting blank cells when doing a print merge. Thanks for your post and for saving me hours and hours of time. Amazing formula!

  18. So helpful, thanks!

  19. Thank you!! This was very helpful and saved me quite a bit of time.

  20. Thank you! This is saving me a LOT of work!

  21. It’s working fine! Thanks a lot for the tip that’s saving me a lot of time…

  22. How do I get Word to find parenthesis containing numbers in between and delete the whole string?

    For example, a sentence may look like this:
    “ACME Company (1.10); XYZ Company”

    Desired outcome:
    “ACME Company; XYZ Company”

  23. There might be an easier way, but this one worked for me using your example:

    Find what: ( )([\(])([0-9]{1,2})(.)([0-9]{1,2})([\)])
    And Replace with nothing.

    NOTE: In the Find What phrase, you’re looking for a space ( ), followed by an opening parenthesis ([\(]), followed by a one- or two-digit number ([0-9]{1,2}), followed by a period (.), followed by another one- or two-digit number ([0-9]{1,2}), followed by a closing parenthesis ([\)]).

    If you want to make sure that you ONLY remove the numbers associated with ACME Company and not anything that matches this pattern, add ACME in front of the Find What string: (ACME Company)( )([\(])([0-9]{1,2})(.)([0-9]{1,2})([\)]) and then put \1 in the Replace With field.

  24. Thanks! It missed a few numbers that didn’t have a number in front of the decimal like (.10) and (.1) which I just had to tweak to ( )([\(])(.)([0-9]{1,2})([\)])and run again. Thanks again! This saved a lot of clean up time!

  25. Is there a way to find and delete all text that is not enclosed in parenthesis?

  26. I did this and it worked – but what do you put in there so the brackets remain as they were (I do not want to change the brackets themselves, just the text within the brackets)? The end result should be red text within black brackets. Any way to do that?

  27. Hi Pat

    I’m not sure that you can automatically. That said, I’m a beginner at wild card searching, so perhaps there’s a way. However, if you use that ‘Find’ string above and DO NOT replace, you can find each instance and then manually change it to red text between the brackets.

    And once you’ve changed it to red, do another ‘find’ for the next one, and this time select the text you want to be red then press F4 (which applies the last action — i.e. applies the same colour you applied to the first one). NOTE: If you do any other action — like delete something — then F4 will delete, and you’ll have to undo and manually apply the red again.

    One way to avoid F4 doing weird things is to select the red text, press Ctrl+Shift+C (this copies the formatting), then on the next ‘find’ select that text, then press Ctrl+Shift+V (this pastes the copied formatting to the selected text).


  28. Hi again Pat

    One other way to do this… follow the instructions in the blog post for changing the whole string to blue (but in your case, choose red). Then run two more wild card find/replace passes to change the colour of the brackets back to normal.

    In the first pass, just put (\[) in the ‘find’, and \1 in the ‘replace’ field. While in the ‘replace’ field, click No Formatting to remove the blue from the first run, then click Format > Font and choose Automatic as the font colour. Make sure ‘Use wildcards’ is selected. Click Replace. If it does what you want, then click Replace All.

    In the second pass, you do the same as the first, except you put (\]) in the ‘find’. Everything else stays the same as for the first pass.


  29. What is the command if I want to replace any word before the special character :
    for example “Andy: blablablabla” I want replace Andy: and patterns that is the same but I dont want to replace 10: (I want to replace only letters and not digits.) Please help me out, this will be a great help to me. Thank you !!!

  30. Hi Winfrey

    I’d try this as a wildcard find/replace:
    Find: ([A-z]@)(:)
    Replace: whatever you want to replace it with – leave blank if you want to replace with nothing. If you want to keep the ‘:’, then replace with whatever you want to replace it with plus \2

    The [A-z] bit finds any letter (upper or lower case) and the @ finds any number of letters.

    If you don’t want the option to preserve the colons, then find: ([A-z]@:)


  31. Thank you so much Rhonda! This really helped me a lot!

  32. really interesting post. i need a wildcard that would help me change a text that appear in track changes (from a specific reviewer) to appear in tc and yellow highlight – is it possible? thanks for your help

  33. Hi Karolina

    I would have no idea where to start with that, though I suspect you might need to write a macro to do it. Try asking this question on the Microsoft Word forum: http://answers.microsoft.com/en-us/office/forum/word


  34. This just worked perfectly in word 2013. Thank you so much!

  35. I can not say how much appreciate you. you taught me a big trick to manage documents in word. thank one million times! :)

  36. Thank you!!! Worked like a charm in Word 2010. Saved me HOURS of work.

  37. Hello. Is there any way I can get this exact functionality within Excel 2013? I have used it successfully in Word 2013 (thanks to this helpful article), but Excel seems to take my “replace” text as a literal string and will not parse my expression properly.

    I have several cells that contain [1], [2], [3] and so on. I want to format the text inside each cell to be a specific font, size, weight and color.

    For example:

    Cell one: [1]
    Cell two: [2]
    Cell three: [3]

    In Word I use the replace functionality to find this: (\[)(*)(\]) and then replace it with this: \1\2\3 and with special font formatting. This works well.

    In Excel I use the replace functionality to find this: ~* and then replace it with this: \1\2\3 and with special font formatting. This does not work. Instead, each cell ends up looking like this:

    Cell one: \1\2\3
    Cell two: \1\2\3
    Cell three: \1\2\3

    Excel is parsing the “replace” expression as a literal string. I’ve tried different ways of trying to get the desired result, but keep coming up short.

    I did some research and everything I find points to Word being able to use expressions like “\1\2\3” but nothing mentions Excel. Any advice?

    Thank you kindly.

  38. I don’t know that this will work with Excel. Excel was designed for numbers and isn’t really a text editor, so I expect that your results are typical of what you can/can’t do in Excel. I know that you can’t do things in Outlook or PowerPoint that you can do easily in Word, and both of those are more text oriented than Excel.

  39. This is great, However, I’m struggling to tweak the code to help me find and remove many iterations of this type of time stamp [00:00:53:00]. Obviously the numbers would continue to change. Your help would be great if you can. Thanks

  40. thank you. best regards and a happy new year.
    Corneliu, Romania.

  41. Hi Andy

    Use wildcards, and put this in the Find field:

    Put nothing in the Replace field, Replace All, and you should remove them all.

    If you used the square brackets, then you can do a standard Find/Replace for [] to remove those too.


  42. thank you, this was very helpful

  43. THANK YOU! These instructions saved me hours of work.

  44. I have been looking for these instructions everywhere — thanks so much for saving me more frustration!

  45. Thank you so much for this solution as I was literally going to have to spend days removing numbers inside square brackets inside a massive word document and now with your solution something that would have taken me days was done in seconds. I love you!!!!!!

  46. Hi

    Looks like, between you, you know lots about ‘find and replace’ and wildcards!

    I’m working on proofreading several hundred documents, most of which need a couple of repetitive changes made to the format of numbered lists, but as I’m new to wildcards, I can’t work out what I need to enter to achieve what I want.

    Issue 1: the current format is like this:

    1) …

    2) …

    etc, and I need it to be:

    (1) …

    (2) …

    Issue 2: the current format is this:

    (1) …

    (2) …

    etc, and I need it to be:

    1. …

    2. …

    If you can help me out on this, I would be very grateful: it would cut down the time I spend on each document considerably.

    Best wishes

  47. Hi Michael

    If the authors have used auto numbering, as I suspect they may have because it’s easy, then find and replace — whether with wildcards or not — won’t help you much.

    Advice: Make a copy of one of your documents BEFORE you do the process below. That way you don’t mess up your original until you have figured out what to do and dealt with the ‘gotchas’, and decided whether you REALLY want to do this…

    Your best bet is to select a range of numbered items, then click the drop-down arrow to the immediate right of the 123 icon on the Home tab, then select the format you need. If you need a format other than that listed, select ‘Define New Number Format’ and add/delete parentheses around the number.

    Be aware that you could totally mess up the numbering sequences!! And may have to start each new set of numbers at ‘1’ again…. The auto numbering in Word may not behave as you want it to. At which point you’ll ask yourself WHY you want to change the punctuation surrounding the numbers and decide it’s just not worth it.

    If it doesn’t change meaning, do you REALLY need to spend time and energy (and frustration) on this?


  48. Hi Rhonda

    Thank you for taking the time to reply to my question so thoughtfully.

    In response, no, the authors haven’t used auto numbering (and, for the reason you’ve suggested, I don’t want to mess up the formatting of the document, which will end up in SGML on the web; and the reason I’m having to make the tedious changes is so that the documents end up conforming to the house style. (The way I look at it is that if they’re paying me for it, I’ll do it!)


  49. Hi Michael

    If they’re paying you for it, AND if the numbers have been manually entered, then yes, there should be a way to use F&R (with or without wildcards) to do what you want.

    Leave it with me for a bit and I’ll get back to you… hopefully with a solution that only targets the numbers and not anything else with that punctuation.


  50. Hi again Michael — can you tell me what comes after a number/punctuation combination? one or more spaces, or a tab?

  51. Hi Rhonda, it’s a space

  52. […] another post on this blog, Michael commented that he had a situation where he needed to run find and replace routines […]

  53. Hi again Michael

    As your requirements vary quite a bit from the original post, I’ve written new instructions for you. They’re here: https://cybertext.wordpress.com/2015/07/14/word-wildcard-find-and-replace-for-numbers-and-trailing-punctuation/


  54. Wow – that’s amazing. A whole page dedicated to my question! Thank you Rhonda. I will try this out on the next document and report back to you. :-)

  55. one question before I go ahead, Rhonda: if the list uses letters, rather than numerals, thus:

    a) …

    b) …

    and I want:

    (a) …

    (b) …

    how should I tweak the find and replace strings?

  56. Hi Michael

    I’ve updated that new post with the tweaks for letters.


  57. Hi Rhonda

    Thanks again for your time, and for updating the blog with the tweak for letters. I tried the string, and in the main it works. However, it’s inserting a line space before the entry (this can be seen when it highlights what it’s about to change), so pushing everything down by a line when it does the replacement. What, in the find string, might be doing this, do you think?

  58. Hi Michael

    It FINDS a paragraph marker above the entry (that’s the (^013) part), and then replaces that paragraph mark with itself. In my testing it didn’t add anything more than what was already there. I’ve emailed you privately.


  59. Thank you for the excellent instructions – it was exactly what I was looking for!

  60. Very useful! This shortcut saved me so much time in formatting old plays from Project Gutenberg. I can’t thank you enough.

  61. Hello,

    I am having a hard time getting the steps to work. I am trying to make changes within the entire word document. When I follow the steps it changes the font of the whole document instead of the font within the brackets. The content within the brackets is [w/p G-5]. I am using Word 2010.

  62. Hi Zan

    Try this (with wildcards ON of course):
    Find: (\[w/p G-5\])
    Replace with: \1 (and specify the font colour, size etc. for the Replace With)

    Test by using use ‘Find Next’ and ‘Replace’ until you are certain you’re not changing anything else. Only use ‘Replace All’ once you are confident of not messing anything else up.


  63. Thank you very much!

  64. Is there a replace command that can delete the entire sentence with a “specific” word “INSIDE” the sentence, not just at the beginning nor end of the sentence? ie..
    yadi yadi ya DIR yadi yadi ya.
    ^13*:*|*:*^13 Does not work for me.
    From my understanding, the following are the descriptions of the codes used:
    ^13 = paragraph tab
    *:* = any and all characters
    | = sentence selection
    = the word “inside” the sentence that is searched for … DIR

    So, the command should execute a search and select the beginning paragraph tab in a sentence with the word DIR inside it and then continue to select the rest of the sentence up to the next paragraph tab. At this point I can leave my “replace with” empty and click select all to perform on the entire document.

  65. Hi Stuart

    I’m not sure where you got your list of expressions from, but I don’t think *:* and | are used in Microsoft Word. These articles describe what expressions ARE used in Word: http://word.mvps.org/faqs/general/usingwildcards.htm and http://www.gmayor.com/replace_using_wildcards.htm

    Now to your question… I got this to work, but only partially. You would have to check each item found because it may get some you didn’t want, and miss others.

    One that worked was:


    but this gets more than a single sentence where DIR occurs. Note that I’ve included the main punctuation marks that typically end a sentence.

    Another that worked more precisely was

    (. )(*)(DIR)(*)([.:;\!\?\)\(])

    as it selected just a sentence containing DIR and the preceding period and space (there’s a space after the period in the Find string). You would have to add a period in the Replace to replace the one found.

    Although (^13)(*)(DIR)(*)(^13) worked too, you would have to ensure that every sentence where DIR occurred was in its own paragraph.

    These may help, but won’t cover every situation. Perhaps run some of these first, then do a final Find for any DIR outliers.

  66. This stuff works perfectly on Word 2016. Thank you! Five Years later, and this post still applies. You rock!

  67. I am a beginner when it comes this stuff. What I am trying to accomplish is a mass replace/delete on a document that is approximately 1,700 pages in length. In all occurrences each section starts with: Correct Answer: and ends with QUESTION nnn. I have tried a large number of the suggestions above but keep ending up with a completely gabled document.

  68. Assuming you want to delete everything between ‘Correct Answer:’ and ‘Question’, this should work:
    * Wildcard find/replace
    * Find what: (Correct Answer:)(*)(Question)
    * Replace with: \1^013\3
    (Note: the ^013 between the \1 and \3 is a paragraph mark)

    PLEASE work on a COPY of your document first.

  69. I need to delete a ton of brackets within a document. How can I do that?

  70. Hi Stephanie

    The easiest way to do that would be a standard Find/Replace with the opening bracket as your first Find (Replace with nothing) followed by Replace All, and the closing bracket as your next Find (again, Replace with nothing and do Replace All). I think that would be quicker and easier than figuring out a wildcard routine for it.

    However, be aware that removing brackets may well change the meaning of the content, so I’d only do ‘Replace’ not ‘Replace All’ and check each instance to see if the brackets needed to be replaced with something else, such as an en or em dash.


  71. Hi guys i wanted to Replace and reformat text inside round bracket () instead of square brackets [] using wildcards. Any idea how can it be done?

    I tried using this (\()(*)(\)) but failed.
    Thanks in advance


  72. Hi Joe

    You need to enclose the special characters in square brackets, so ([\(])(*)([\)]).


  73. Hello,
    I can’t print text within the brackets even though I can see them on the screen in Adobe, please help.
    Thank you in advance.

  74. Rhonda, congratulations for your excellent support to this page.
    I guess, it’s a very useful resource for many of us needing that kind of help using Word Search & Replace.

    My question, if you still there, or any other user who knows the solution, is how to find and replace bulleted and numbered list formatting.
    My work here needs just delete them at once.
    There is no such thing at “Format” nor “Special” button, but only Section, Fields,…

    I have a very big text with too many bulleted lists with no character in it, among normal text.


  75. Hi Gab

    The easiest way to do this is to select all text with the style, then clear the formatting. If you used the bullet icon from the menu to apply the bulletting, then the style is ‘List Paragraph’; if you have your own style for bulletting, then you need to know that style’s name. The steps below assume ‘List Paragraph’ is the style.

    1. On the Home tab, go to the Styles group.
    2. Click the tiny arrow in the right corner of that group — this opens the Styles panel.
    3. Hover over the ‘List Paragraph’ style’s name until you see the drop-down arrow for it.
    4. Click that arrow.
    5. Click the ‘Select All xx Instances’ option.
    6. Back on the Styles panel, go to the top and click ‘Clear All’ — this takes the formatting of the style back to ‘Normal’.

  76. Rhonda, thank you very much for your prompt response!

    Unfortunately, bulleted text is already under Normal Style and, thus, it’s masked/hidden among normal text…
    I see no way to isolate it. :-(

    I’ll ask a favor to send a tiny piece of it to your e-mail, just 3 pages of more than 200 of original one.

  77. I spent over an hour trying to find a way I can remove links enclosed in curly brackets from a document. (\{)(*)(\}) is the only thing that worked. THANK YOU!

  78. Perfect!! Thank you :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: