Inserting and Formatting Text > Searching and replacing text, tags, and attributes > Saving search patterns

 

Saving search patterns

You can save search patterns for later use by clicking the Save Query button in the Find or Replace dialog box. Saving a query is a good idea if you regularly perform the same search and do not want to reconstruct the search pattern every time. For example, you might want to strip out nonstandard tags from documents created with another visual HTML editor, or to confirm that all images in a file have height, width, and alt attributes before the document goes live on the Web.

To save a search pattern:

1 Set the parameters for the search by following the steps outlined in Searching and replacing text, tags, and attributes.
If you are performing a tag or advanced text search, see Searching for HTML tags and attributes or Searching for text contained in specific tags for information about setting additional search parameters.
2 Click the Save Query button (identified with a disk icon).
The default location where queries are saved is the Configuration/Queries folder inside the Dreamweaver application folder.
3 In the dialog box that appears, give the file a name that identifies the query and click Save.
For example, if the search pattern involves looking for img tags with no alt attribute, you might name the query img_no_alt.dwr. Find queries end in the extension .dwq; Replace queries end in the extension .dwr.

To recall a search pattern:

1 Choose Edit > Find and Replace.
2 Click the Load Query button (identified with a folder icon).
The Load Query dialog box automatically opens in the Configuration/Queries folder. You can navigate to another folder if you have saved queries elsewhere.
3 Select a query file and click Open.
If you are in the Find dialog box, only Find queries (.dwq files) are available. If you are in the Replace dialog box, both Find queries (.dwq files) and Replace queries (.dwr files) are available.
4 Click Find Next, Find All, Replace, or Replace All to initiate the search.