Usage instructions

This is a short manual for WordPress search and replace. It also includes a very short (crash course style) tutorial of regular expressions — I like to call it How to learn regular expressions in just 5 minutes.

Having trouble with WordPress search and replace? Incorrect or unexpected replacements? Search and replace is not doing what you intended? Remember that a regular expression search does not always behave like a normal text search.

The basics: how to open the search and replace toolbar

While editing a post, click the “Search/Replace” button on the Quicktags strip. A toolbar will appear, below the Quicktags strip:

This is how the toolbar looks like, once the button has been clicked

How to use the toolbar

  1. First, type the regular expression you’re looking for in the Expression box. Plain strings work well as regular expressions, but you have the entire power of Perl-compatible regular expressions at your hand.
  2. Then, type the replacement text in the Replacement box.

Once you’re done, hit the Replace button, and wait a few moments while the server performs the match and replace. After a few moments, your post contents box will have the new, processed content.

Using parts of the searched text as portions of the replacement text

If your expression has parenthesized groups — (...) — you can use the $1$9 identifiers to insert the content for the corresponding group in the Replacement box. See the regular expression tutorial for an explanation of match groups.

Options

The Ignore case checkbox makes WordPress search and replace ignore whether the text sought after is lowercase or uppercase: replacing “cat” for “dog” will also replace instances of “CaT”, “caT”, and so on.

The Periods match newlines too checkbox lets a period (.) match a newline as well. The normal behavior of the period is to match any character except for the newline. This checkbox lets you override the default behavior.