Find and Replace in Word: Wildcards, Formatting and Special Characters
By Guccibase · · 9 min read

Find and Replace in Word can do much more than swap one word for another. Press Ctrl+H to open the Replace tab, then select More. That reveals Match case and Find whole words only, a Format button for finding and replacing formatting, a Special button for codes such as paragraph marks (^p) and tabs (^t), and Use wildcards for pattern matching. This tutorial works through each one with examples you can copy, starting simple and ending with wildcard patterns. The steps follow Microsoft's own documentation, linked throughout, and were last checked against it on 5 November 2026.
Key Takeaways
- Ctrl+H opens Replace. More shows the search options, Format and Special.
- Find whole words only stops "art" from matching inside "start". Match case keeps "May" (the month) apart from "may".
- Codes such as
^p(paragraph mark),^t(tab) and^l(line break) let you clean up spacing and pasted text.- Use wildcards turns Find into pattern matching. Test with Find Next before you select Replace All.
- Advanced options are in the desktop app. Word for the web offers basic Find and Replace only.
Before you start
You need the Word desktop app for Windows or Mac. Microsoft's Find and replace text page notes that Word for the web supports basic find and replace with Match case and whole-word matching, and recommends the desktop app for formatting, special characters and wildcards.
Two habits make every replace safer:
- Save first. A large replace is easy to undo straight away with Ctrl+Z, but not after you have closed the file.
- Test with Find Next. Step through the first few matches before you select Replace All, so you see what your search actually catches.
If other people need to check your replacements, turn on Track Changes first. Each replacement is then recorded as a tracked change they can accept or reject.
Step 1: Open Find and Replace
On Windows, go to Home > Editing > Replace, or press Ctrl+H. Ctrl+F opens the Navigation pane search instead; Ctrl+H goes straight to the Replace tab. Both shortcuts are on Microsoft's Keyboard shortcuts in Word page.
The dialog has three tabs: Find, Replace and Go To. On the Replace tab:
- Find what is the text or pattern to search for.
- Replace with is what goes in its place. Leave it empty to delete every match.
- Find Next moves to the next match, Replace replaces the current match and moves on, and Replace All replaces every match and tells you how many it changed.
On a Mac, choose Edit > Find > Advanced Find and Replace, or select the magnifying glass in the Navigation pane search box, then the gear icon, and choose Advanced Find & Replace, as Microsoft's Find and replace page describes. Select the arrow at the bottom of the dialog to show all the options.
Step 2: Use Match case and Find whole words only
Select More to expand the dialog. The Search Options area holds the checkboxes that make a replace precise. These are the main ones:
| Option | What it does | Example |
|---|---|---|
| Match case | Finds only text with the same capital letters | Finds "May" but not "may" |
| Find whole words only | Ignores matches inside longer words | "art" no longer matches "start" or "party" |
| Match prefix / Match suffix | Matches only at the start or end of a word | Suffix "ing" matches "editing", not "ingredient" |
| Ignore punctuation characters | Treats "re-use" and "re use" alike | Useful for inconsistent hyphenation |
| Ignore white-space characters | Ignores white space between words | Extra spaces between words do not stop a match |
The Search box sets the direction: All, Down or Up. If you select text before you open the dialog, Word searches the selection first and then asks whether to search the rest of the document.
Whole-word matching prevents a common kind of damage. Replacing the name "Ann" without it also changes "Annual" and "planning". You can try this on a real file in the free exercise Replace a name without breaking other words, and the Find and Replace with Match case and Whole words lesson explains both options.
Step 3: Find and replace special characters
Some things in a document cannot be typed into Find what: paragraph marks, tabs, line breaks, page breaks. Word uses codes that start with a caret (^). Select Special at the bottom of the expanded dialog to insert one from a list, or type the code yourself.
The codes below come from Microsoft's search options guidance for Word:
| To find | Code |
|---|---|
| Paragraph mark | ^p |
| Tab | ^t |
| Manual line break | ^l |
| Manual page break | ^m |
| Section break | ^b |
| Column break | ^n |
| Nonbreaking space | ^s |
| Nonbreaking hyphen | ^~ |
| Optional hyphen | ^- |
| Em dash | ^+ |
| En dash | ^= |
| Any character | ^? |
| Any digit | ^# |
| Any letter | ^$ |
| White space | ^w |
| Footnote mark / endnote mark | ^f / ^e |
| Graphic | ^g |
| Field | ^d |
| Caret character itself | ^^ |
Recipes for common clean-ups
- Remove empty paragraphs. Find
^p^p, replace with^p, and select Replace All until Word reports 0 replacements. Then use paragraph spacing instead of blank lines, as in the free exercise Replace blank lines with paragraph spacing. - Fix text pasted from email. Find
^l(line breaks), replace with a space, so each paragraph flows again. Text pasted from a PDF often ends every line with a paragraph mark instead; the wildcard recipe further down handles that case. - Remove double spaces. Find two spaces, replace with one space, and repeat until nothing is found.
- Replace tabs with a single space. Find
^t, replace with a space. - Turn hyphens between numbers into en dashes. This needs a pattern, so it is covered under wildcards below.
The Cleaning up with Find and Replace lesson practises these spacing fixes.
Step 4: Find and replace formatting
The Format button at the bottom of the expanded dialog lets you search for formatting as well as text, and replace it with different formatting. Its menu offers Font, Paragraph, Tabs, Language, Frame, Style and Highlight.
To change all underlined text to italic, for example:
- Click in Find what and leave it empty.
- Select Format > Font, choose the single underline style, and select OK. "Format: Underline" appears under the box.
- Click in Replace with and leave it empty.
- Select Format > Font, set Underline style to (none) and Font style to Italic, and select OK.
- Select Replace All.
An empty box with formatting means "any text with this formatting". Typing text as well narrows the search to that text in that formatting.
The free exercise Replace underline emphasis with italics checks exactly this replacement.
Replace a style. Use Format > Style in both boxes to move every paragraph from one style to another, for example from a pasted "Heading Custom" style to Heading 2.
Clear the formatting afterwards. Formatting settings stay attached to the boxes until you remove them. Click in each box and select No Formatting before your next search, or the next search will look only for formatted text.
Step 5: Turn on wildcards
Select More, then tick Use wildcards. Find what now accepts patterns rather than plain text. Two things change when you do this:
- Match case and Find whole words only become unavailable. Wildcard searches are always case-sensitive, so
[Mm]ayis how you match both forms. - Some special codes behave differently. With wildcards on, the paragraph mark must be written
^13in Find what, although^pstill works in Replace with, as a Microsoft Q&A moderator explains in this answer on paragraph marks and wildcards. The "any" codes from Step 3 (^?,^#,^$) are for normal searches; with wildcards on, use?for any character,[0-9]for any digit and[A-Za-z]for any letter.
These wildcards come from Microsoft's search options guidance for Word:
| Wildcard | Matches | Example |
|---|---|---|
? |
Any single character | s?t finds "sat" and "set" |
* |
Any string of characters | s*d finds "sad" and "started" |
< |
The beginning of a word | <(inter) finds "interesting" but not "splintered" |
> |
The end of a word | (in)> finds "within" but not "interesting" |
[ ] |
One of the listed characters | w[io]n finds "win" and "won" |
[-] |
Any character in a range (ascending order) | [r-t]ight finds "right", "sight" and "tight" |
[!x-z] |
Any character except those in the range | t[!a-m]ck finds "tock" and "tuck" |
{n} |
Exactly n of the previous character or group | fe{2}d finds "feed" but not "fed" |
{n,} |
At least n | fe{1,}d finds "fed" and "feed" |
{n,m} |
Between n and m | 10{1,3} finds "10", "100" and "1000" |
@ |
One or more of the previous character or group | lo@t finds "lot" and "loot" |
To search for one of the wildcard characters themselves, such as a question mark or a bracket, put a backslash in front of it: \? finds a literal question mark.
Use groups to rearrange text
Parentheses group part of a pattern (Microsoft's guidance uses them in examples such as <(inter)), and in Replace with you refer to each group by number: \1 for the first, \2 for the second, and so on (WordTips on wildcard groups). This is how you rearrange text rather than just replace it.
The recipes below combine the wildcards and codes documented above. Try each one with Find Next on a copy before you select Replace All.
Swap "Surname, First name" to "First name Surname":
- Find what:
(<[A-Z][a-z]@), ([A-Z][a-z]@>) - Replace with:
\2 \1
"Lopez, Maria" becomes "Maria Lopez". The pattern means: a capitalised word (group 1), a comma and space, then another capitalised word (group 2). It will not match names such as "McDonald", "O'Neil" or names with accented letters, so check the list afterwards.
Put an en dash between number ranges:
- Find what:
([0-9])-([0-9]) - Replace with:
\1^=\2
"pages 12-18" becomes "pages 12–18", while hyphens in words such as "follow-up" are left alone. The pattern also matches dates written as 2026-11-05, phone numbers and part codes, so step through with Find Next or select only the text you want to change first.
Collapse runs of spaces to one:
- Find what:
{2,}(a space followed by{2,}) - Replace with: a single space
Rejoin lines in text pasted from a PDF:
- Find what:
([!^13])^13([!^13]) - Replace with:
\1 \2
This replaces a single paragraph mark between two characters with a space, but leaves double paragraph marks (real paragraph breaks) alone. Select the pasted block first and run it only there.
Remove runs of empty paragraphs in one pass:
- Find what:
^13{2,} - Replace with:
^p
Step 6: Check the result
After a Replace All, read Word's count of replacements. If it is far higher or lower than you expected, press Ctrl+Z straight away: the whole Replace All is undone in one step. Then:
- Scroll to a few of the changed places and read them in context.
- Search again for the old text. If you replaced a renamed product or team everywhere, Find should now return nothing.
- If Track Changes was on, use the Reviewing Pane to see each replacement listed.
The free exercise Replace a renamed service everywhere checks that no old name is left behind.
Troubleshooting
- Word finds no matches, but the text is there. A formatting setting from an earlier search may still be attached to Find what. Select No Formatting. Also check that Use wildcards is not ticked by accident.
- "The Find What text contains a Pattern Match expression which is not valid." The wildcard pattern has a mistake, often an unbalanced bracket or a special character that needs a backslash.
- The replacement hit parts of other words. Turn on Find whole words only, or with wildcards use
<and>around the word. - Paragraph marks will not match with wildcards on. Use
^13in Find what instead of^p. - Replace All only changed part of the document. Text was selected when you started. Answer Yes when Word asks whether to search the remainder.
Where to go next
Find and Replace also comes up in Word skills tests; the Word skills test guide explains what to expect. The Selecting, editing, undoing, and replacing text module covers it alongside precise selection, and the Word Find and Replace practice page collects every replace exercise. If the document is going to someone outside your team after the clean-up, finish with How to Remove All Comments and Tracked Changes Before You Send a Document.
Related posts
Written by Guccibase; see how these guides are written. Word Exercises is independent and not affiliated with Microsoft. Menu names follow Microsoft 365 as of 2026.