Chapter 11: Advanced Topics
Using Advanced Search and Replace Functions
Problem
You need to find or replace data, and the quick search box is not sufficient.
Solution
Use the Search & Replace tool to find and optionally replace text found in the content.
Discussion
The quick search box found on nearly every screen of the Movable Type interface is great for quickly looking up information, but could fall short if you need something more granular. In these cases you can use the Advanced Search and Replace tool to find text and optionally replace, it in a wide variety of items in the application. These items include:
- Entries
- Comments
- Commenters
- TrackBack Pings
- Activity Log
- Templates
To use the tool, click the Search button on the Weblogs Toolbar. The functionality is also available as a system level resource by clicking the Search button on the System Toolbar.
Across the top are tabs for the application items you can search. Under the search box will be a number of different options to more precisely tailor your search. Which options are available will vary slightly based on what items are searched. These options are:
- Case Sensitive
By default, searches are case insensitive. Checking this option the case of the search term will be considered.
- Regular Expression (RegEx) Match
With this option enabled, the term will treated as a regular expression pattern. A regular expression is a string that describes or matches a set of strings according to certain syntax rules. For more on regular expressions see http://en.wikipedia.org/wiki/Regular_expressions.
- Limited Fields
Selecting this option will open a dynamic control to define which fields to perform the search on.
- Date Range
This option limits the search to a specific date range. Selecting it will open a dynamic control where you can enter a start and end date.
The date controls are rather vague. What format are dates to be entered?
- Is Junk
Available only on comments and TrackBack ping searches, this option limits the search to items marked as junk.
Once you have entered a query and selected the applicable search options, click the Search button to run it. The results will be returned in the same listings interface found throughout the application, including all of the controls for managing and acting on the found items.
Having performed an initial search, you can search again, or perform a search and replace on all or some of the results.
Search & Replace
With the results of a previous search displayed, Movable Type gives you the option of finding the term and replacing it with another string. This operation does not have to be performed on all the results. You can choose to replace matches in just a few selected search results or constrain the operation to specific fields of those items. For instance, you could search templates for a specific file path and replace a portion with a new path in only four of them.
To perform a replace, select the "Search & Replace" option and enter the replacement text. Set your search options, such as specific fields or case sensitive search, and select one or more of the results to target. Once you are ready click the Replace Checked button.
Be extremely careful when doing a replace, because there is no undo.



