Woven Words Logo




Tips



Resources



About Woven Words

Finding and replacing 'special' characters using wildcards

There are untold Find and Replace variations which can be performed using the wildcard hints that I posted earlier (see Taking the 'hyph' out of hyphens and Keeping your numbers and units stuck together).

One aspect which I haven't covered yet is the treatment of certain special characters when using wildcards. These are characters which are commonly used as part of wildcard expressions or formulas, such as brackets or question marks. If they are being used to make the expression work, how can the characters themselves be found and replaced?

This is when you need to use the backslash character: '\'. Whenever you want to use one of the wildcard special characters in your search, just precede it with a backslash.

Special characters which are affected in this way include round brackets, square brackets, angled brackets, question marks, asterisks, exclamation marks and @ signs.

Here's an example where I want to remove all the round brackets surrounding a year in a bibliography (for example, change '(2003)' to '2003').

  1. Go to Edit > Replace...
  2. Make sure the Use wildcards option is selected.
  3. In the Find what: box, type in the following:
  4. \((<[0-9]@>)\)
    This finds an opening round bracket: '\(', followed by a set of numbers: '(<[0-9]@>)', followed by a closing round bracket: '\)'.
  5. In the 'Replace with:' box, type in the following:
  6. \1
    which repeats the set of numbers, without the round brackets around it.
  7. Click on Replace All.

Simple!

Note: You don't need to use the backslash character in the Replace with box for these 'special' characters.

Home | Tips | Resources
About Woven Words

Go to topLast updated: Tuesday 28 September, 2004
© 2004