Unit 15. HTML and Dreamweaver

Find and replace


Sometimes we want to search a web site for all the pages with certain texts, labels, or parts of these elements. We might want to replace them because we need to work in these elements and don't remember which ones they were, or because we want to replace some labels with others.

Let's imagine an existing web site, where the majority of the pages have text that makes reference to the site's name from the start.

For example, all the pages could start with DogsCats, and it is for sure that that phrase isn't in any other part of the site apart from the start. Now let's imagine that a cat and a dog image have been created, and you want to replace the DogsCats text for the image in all the pages.

In this case it is not necessary to open all the pages that contain the text one by one, and neither to modify the pages to replace the text for the image one by one. To perform this task it is easier using the Find and replace tool.

You can open it through the Edit menu, and then selecting the Find and replace option, or by pressing Ctrl+F.

Through Find in you can specify whether it's going to be looked for in the actual file, in the entire site, or only in the selected site files (previously selected).

Through Search you can specify whether the text needs to be looked for (in the desgin window), or in the HTML code (font code).

Next to the Find option list, there is a text window in which you need to indicate the text or the code you want to look for.

In Replace you must specify the text or the code you want to replace the text or code found with.

The replacement can be made in various ways, but always through the right buttons. To search one by one for the files that contain the code or text needed, and once found to replace them when you need, use the buttons Find Next and Replace.

If you want to find all the files that contain the text or code, or to replace all of them, use the Find All and Replace All buttons.


When you use the Find Next option, a page with the coinciding text is opened, highlighting the font in the list near to the code line in which it is. This way we can decide the changes we want to make one by one. When we are sure about the replacements we want we just need to click on Replace, or if we don't want to make any changes we just need to click on Find Next again.


When we use the Find All option, the Find and replace window closes and a new panel like the one to the right is opened. Here are all the files in which the text coincides with the searched text or code.

By clicking on the button, the Find and replace window is opened. From this window we can replace from the found files, one by one with the Replace button, or directly replace all found files, by selecting the Replace All option.

In the panel, when any file has been changed, it will appear again in the list near a green circle, which indicates that it has been previously replaced.

We can make errors when we search, or replace text or error codes. You have to be very careful when you use this tool, because it's not possible to undo the changes done to the closed files with the find and replace option.

In the previous example, the person wants to search for the DogCats text, and replace it with an image. In this particular case, what you want is to replace the text with an image, so in Find we couldn't choose the Text option, we would have to select Source code.

In Replace the complete HTML label would have to be specified to insert the image. In this case the label would be <img scr="images/logo_animals.gif">, knowing the image is called logo_animals.gif and is found inside the site in the images folder.


To practice the different aspects explained, you can perform the Step by step exercise on Finding and Replacing.

  Unit 15 exercises.

  Unit 15 Test

  Ir a la página anterior Índice del curso  

Page. 15.3