Intermediate Dreamweaver

Basic HTML | Site management | Assets | Library of Page Elements| Find and Replace | Templates | Style Sheets | Forms | Imagemaps | Mouseovers | Flash buttons & text | Frames | Tables: Formatting & Sorting | Preview Browsers | Font Lists | Colors | Automating Tasks | Pasting in a Script

Find/Replace

Dreamweaver includes a very sophisticated Find/Replace utility that lets you run searches and do global replacements on the text of documents, the HTML code, specific tags, or even text associated with specific tags, within the page or across multiple pages in a site or folder.

To use this function, go to the Edit menu and choose Find and Replace. Choosing Find/Replace from the Edit menu brings up the basic Find/Replace window:

Find/Replace window: Text

  1. Find In: lets you set the area to search-- you can search only the current document, or the entire site, a folder, or specific documents in the site.
  2. Search: lets you search for text from the document, code, specific tags, or (in Text Advanced) text in conjunction with some tag.
  3. Find: enter the text/code to search for.
  4. Replace: enter the text/code/etc to insert in place of the found text if you use Replace or Replace All
  5. Options let you specify whether to match only searches capitalized the same way, treat spaces between words, etc. differently, etc.

To simply find the item, click Find. Once you've found it, you can replace it by clicking Replace. To replace every instance of the item in the chosen area, click Replace All.

Searching Code

You can change the settings so that you can do a search and replace in the HTML code of the document.

Find/Replace window: Source Code

  1. Find in is still the area to search. Above it has been set to the whole site.
  2. Search is changed to Source Code
  3. In the box next to Source Code, enter the HTML code to search for
  4. In Replace With: enter the code to replace it with, if you are going to replace it.

If you make changes to the document which are not compatible with HTML structure, the offending tags will appear on the page in yellow until you fix the problem.

Searching by Tag

You can also choose to search for specific tags and their attributes, either to make changes to the attributes or to the tags.Find/Replace window: Tag

  1. Change the Search drop down to Specific Tag
  2. Next to Specific Tag, type or select an HTML tag to look for.
  3. In the next line you can specify qualities to look for with the tag: you can look for tags with or without a specific attribute, Tags containing or not containing specific text, tags inside or not inside specific other tags. Using the + and - buttons, multiple qualities can be specified.
  4. Here the attribute, text, or other tag is specified.
  5. If you are looking for a specific attribute, you need to specify its value, using =, <,>, or != (not equal to)
  6. The specified attribute value should be chosen, typed or pasted here. If the value does not matter, choose [any value]
  7. The Action taken when the replacement is done can be Replacing the tag and its contents, replacing the contents only, removing the tag & contents, Stripping out the Tag, Changing the Tag, Setting or Removing the Attribute, or adding things Before or After the Start or End Tag.
  8. Next to the Action is a field, depending on the Action, where the tag, attribute, text, etc. can be specified.

This makes it possible to look for every instance of, say, font face="Arial" within a list item, and change it to font face="Arial, Helvetica, sanserif".

February 5, 2004