Jefferson asked how he could use a wildcard search to find text between ‘chevron’ arrows, i.e. the less than (<) and greater than (>) symbols on the keyboard above the comma and period keys.
I wasn’t sure what he wanted to do with that text once found—bold it, italicise it, highlight it, etc.—so this post shows you how to highlight it. If you want to do something else, then you’d change the Font setting at Step 8 below.
NOTE: This find/replace finds ALL words between a matching set of < and > symbols, so if you only use one (say, for less than) and not the other for several pages, then all the text in the pages in between will be highlighted.
- Before you start, select a highlight colour from the Home tab on the ribbon (this is essential if you’re intending to highlight the text found).
- Press Ctrl+h to open the Find and Replace window.
- Click More.
- Select the Use wildcards checkbox.
- In the Find field, type: (\<)(*)(\>)
- In the Replace field, type: \1\2\3
- At the bottom of the window, click Format.
- Select Highlight. (If you want bold or italic, select Font instead, then Bold or Italic).
- Check that the formatting you want is shown BELOW the Replace field (see screenshot).
- Click Find Next then Replace for each one found (ONLY press Replace All if you are absolutely certain that every opening chevron arrow has a closing one, and that there are no mathematical uses for the chevrons).
How this works
- Chevron arrows are special characters in a wildcard search so they must be ‘escaped’ to act as chevrons—you do this by placing a \ immediately before the special character, so for each you would write them as \< and \>
- Any characters and any number of characters is expressed using an asterisk *
- The parentheses separate each part of the Find, so (\<) looks for an opening chevron, then (*) looks for ANY and ALL characters after the opening chevron, and (\>) looks for the closing chevron. In other words, find anything between an opening and closing chevron, whether it’s a single character or a bunch of words.
- In the Replace, the \1\2\3 tell Word to replace the first, second and third parts of the Find with themselves; i.e. make no change.
- The formatting under the Replace field tells Word to format the replace string with the formatting selected (i.e. in this case, highlight the original words and the chevrons in the highlight colour selected in Step 1 in this example).