Find and Replace is used to find an individual word or a string of text (either regular or HTML) and replace it with a different string of text. This may not sound like a big deal, but in reality it is very powerful.
The power of this tool is our own use of repetitive text or code. A web site will contain many repetitive words or strings of text. An example is the name "Inside Dreamweaver Management Tools" in the navagational link column on the left. Another example may be the "mailto:" link in a faculty or department web site. Using find and replace we can easily find the desired text and automatically replace it with different text.
Find and Replace in the Current Document
To see how this is done, create a file named "FindReplaceMe1.html".
- go to the "File" menu
- choose "New..."
- in the dialog box click on the "General" tab
- in the "Category:" column choose "Basic Page"
- in the "Basic page:" column choose "HTML"
- click "Create"
- title the page "Find and Replace 1"
- insert a mailto link in the body of the page
- go to the "Insert" menu
- choose "Email Link"
- in the "Text:" box, type "send email to breeves@d.umn.edu"
- in the "E-Mail:" box, type in the email address
- click "OK"
- save as "FindReplaceMe1.html" in a new folder in your site named "FindReplace"
- create 4 more pages like this changing the title and file name (hint: "Save As...")
Now the email address needs to be changed in all 5 pages. First, change the address in the current page. Use "FindReplaceMe1.html".
- on the page, go to the "Edit" menu
- choose
"Find and Replace..." (See Figure 3: Find and Replace dialog box)
Figure 3: Find and Replace dialog box
- in the "Find:" text box type "send email to breeves@d.umn.edu"
- in the "Replace:" text box type "send email to your_internetid@d.umn.edu"
- click "Replace All"
- click "Close"
Find and Replace in a Folder
Now replace all instances of this email address in a folder. Using "Figure 3: Find and Replace dialog box" as a guide:
- go to the "Find In:" drop down menu
- choose "Folder..."
- click on the folder icon
- select the folder "FindReplace"
- click "Choose"
- enter find criteria
- enter replace criteria
- click "Replace All"
- click "Close"
Find and Replace in a Site
This same find and replace may be done on the entire site. The "Find In:" drop down menu is the key.
Find and Replace HTML Source
All of the above searches may also be done on HTML code. The visible text was changed from "breeves@d.umn.edu" but the acutual html code was not. Using "Figure 3: Find and Replace dialog box" as a guide:
- go to the "Find In:" drop down menu
- choose "Folder..."
- go to the "Search:" drop down menu
- choose "Source Code "
- in the "Find:" text box type "mailto:breeves@d.umn.edu"
- in the "Replace:" text box type "mailto:your_internetid@d.umn.edu"
- click "Replace All"
- click "Close"
You may have noticed in the "Find:" drop down menu that advanced searches on text and tags also may be done. Find and Replace is a very powerful tool.