Skip to content
Tutorials Center
My learning

Topics

Lesson 36 of 42 ยท Mail Merge, Macros and Automation

Advanced Find and Replace in Word

Master Word's Find and Replace: match case, formatting and styles, special codes like ^p and ^t, wildcard patterns with groups, and practical clean-up recipes.

The basic Find (Ctrl+F) looks for a word. The Advanced Find and Replace dialog (Ctrl+H) can find formatting, styles, paragraph marks, and patterns, and replace them all in seconds. It is the most useful time-saver for cleaning pasted or inherited documents.

Open it with Ctrl+H (Replace) or Home > Replace, then click More >> to expand the options.

Search options

Option Effect
Match case "Word" does not match "word"
Find whole words only "art" does not match "party"
Use wildcards Turns on pattern matching (below)
Sounds like (English) Finds "write", "right"
Find all word forms (English) Finds "run", "ran", "running"
Match prefix / suffix Matches the start or end of a word
Ignore punctuation / white-space Looser matching
Search: Up, Down, All Direction

Buttons: Find Next, Replace (one), Replace All, Reading Highlight (highlights hits), Find In (current selection or main document). Always check the count in Replace All: "Word has completed its search and has made 14 replacements."

Use Ctrl+Z immediately if a replacement goes wrong, and test on a selection first.

Format and Special

The Format button, available for both Find and Replace boxes, matches or applies Font, Paragraph, Tabs, Language, Frame, Style and Highlight. Use it to:

  • Replace all text in the style "Strong" with Heading style, or one style with another.
  • Replace bold italic with italic only.
  • Remove all highlight (find highlight, replace with no highlight).
  • Replace English (US) language tags in a document.

Leave the text boxes empty to search for formatting alone. No Formatting clears the format of the current box, and always do this before the next search to avoid leftovers (a common bug: a previous search still has "Font: Bold" set under the box).

The Special button inserts codes for characters you cannot type:

Code Meaning
^p Paragraph mark (Enter)
^l Manual line break (Shift+Enter)
^t Tab
^w White space (any run of spaces/tabs)
^m Manual page break
^b Section break
^s Non-breaking space
^~ Non-breaking hyphen
^& The found text (in the Replace box)
^c Clipboard contents (in the Replace box)
^#, ^$, ^? Any digit, any letter, any character
^f, ^e Footnote mark, endnote mark
^g Graphic
^d Field

Examples: replace ^p^p with ^p to remove double paragraph marks, ^l with ^p to turn line breaks into real paragraphs, and ^t^t with ^t.

Wildcards

Tick Use wildcards to switch to pattern matching. The special-character list changes, and ^t style codes partly remain. The most useful wildcards:

Pattern Matches
? Any single character
* Any string of characters (non-greedy)
[abc] One of a, b or c
[a-z], [0-9] A range
[!abc] Any single character except those
< and > Start and end of a word
Exactly n of the previous item
{n,m} Between n and m
@ One or more of the previous item
(...) A group
\1, \2 The matched group in the Replace box
\ followed by a character The literal character (for example \()

Notice that Word's wildcards are not regular expressions: * already means "any text", and there is no | (or) or +. Use @ for "one or more".

Practical recipes

  • Swap "Last, First" to "First Last": Find (<[A-Za-z]@>), (<[A-Za-z]@>), Replace \2 \1.
  • Format all phone numbers: Find ([0-9]{3})-([0-9]{3})-([0-9]{4}), Replace (\1) \2-\3.
  • Make every text in brackets bold: Find \[*\], Replace with ^& and set Format > Font > Bold.
  • Fix multiple spaces: with wildcards on, Find {2,} (a space, then {2,}) and Replace with one space. Without wildcards, replace two spaces with one until no replacements remain.
  • Find dates like 12/31/2026: [0-9]{1,2}/[0-9]{1,2}/[0-9]{4}.
  • Remove all text between parentheses: \([!\)]@\).
  • Convert a list pasted with tabs into a table: replace ^p pattern first, then use Convert Text to Table.

How Word wildcards map onto regular expressions

If you know regular expressions, a translation shows the difference. This stand-in turns a Word wildcard into a Python regex and tests the recipes above. It handles only the pieces listed here.

Python Word wildcards to regex (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Replace and the clipboard

^c in the Replace box inserts whatever you last copied (Ctrl+C), including formatting. A trick: copy a table, then replace the placeholder text [TABLE] with ^c. This lets you insert a complex object in many places at once. ^& repeats the found text, which is useful for adding formatting to the thing you found without retyping it.

Go To and Select

  • Ctrl+G jumps to a page, section, line, bookmark, comment, field, table, graphic, equation, footnote or heading.
  • Home > Select > Select Objects and Select Text with Similar Formatting pick every piece of text that looks like the current one, so you can restyle or delete them together.
  • Navigation Pane search (Ctrl+F) shows results in context; its search box also has options for Graphics, Tables, Equations, Footnotes/Endnotes and Comments.

Wrap-up check

A short checklist before Replace All:

  1. Do I know exactly what will match? Use Find Next or Reading Highlight first.
  2. Are there leftover formats under the boxes? Click No Formatting.
  3. Is tracking on? Turn on Track Changes (Track Changes and Comments) if another person needs to see the edits.
  4. Do I have a copy? Use File > Save a Copy if the change is large.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which code finds a paragraph mark?

    ^p is a paragraph mark; ^l is a manual line break and ^t is a tab.
  2. 2. In Word wildcards, which symbol means 'one or more of the previous character'?

    Word uses @ instead of the + used by regular expressions.
  3. 3. What do \1 and \2 do in the Replace box when wildcards are on?

    They refer to the text matched by parenthesized groups in the Find box.
  4. 4. Why click No Formatting before a new search?

    Format settings stay under the boxes and silently change what matches.

Summary

  • Ctrl+H with More >> exposes case, whole word, wildcards and format options.
  • Special codes (^p, ^t, ^l, ^w, ^&, ^c) handle invisible characters and clipboard text.
  • Wildcards use ?, *, [ ], < >, { }, @ and groups with \1, \2.
  • Match formats and styles to restyle text in bulk.
  • Test with Find Next, clear stray formatting, and keep a backup.

Next: Add-ins, Copilot and Office Integration