Inserting and Formatting Text > Searching and replacing text, tags, and attributes

 

Searching and replacing text, tags, and attributes

You can search the current document, selected files, a directory, or an entire site for text, text surrounded by specific tags, or HTML tags and attributes. Note that you use different commands to search for files, and to search for text and/or HTML 1 tags within files: Locate in Local Site and Locate in Remote Site search for files, while Edit > Find and Replace search for text and tags within files.

To search for text and/or HTML within documents:

1 Choose from the following options:
In Design view, from the Document or Site window, choose Edit > Find and Replace.
While in Code view, right-click (Windows) or Control-click (Macintosh) and choose Find and Replace from the context menu.
2 In the Find or Replace dialog box that appears, use the Find In option to specify which files to search:
Current Document confines the search to the active document. This option is available only when you choose Find or Replace with the Document window active, or from the context menu in the Code inspector.
Entire Local Site expands the search to all the HTML documents, library files, and text documents in the current site. After you choose Current Site, the name of the current site appears to the right of the pop-up menu. If this is not the site you want to search, choose a different site from the current site's pop-up menu in the Site window.
Selected Files in Site confines the search to the files and folders that are currently selected in the Site window. This option is available only when you choose Find or Replace with the Site window active (that is, in front of the Document window).
Folder confines the search to a specific group of files. After choosing Folder, click the folder icon to browse to and select the directory you want to search.
3 Use the Search For option to specify the kind of search you want to perform.
Source Code lets you search for specific text strings in the HTML source code. See About HTML source code searches.
Text lets you search for specific text strings in the Document window. A text search ignores any HTML that interrupts the string. For example, a search for the black dog would match both the black dog and the <i>black</i> dog.
Text (Advanced) lets you search for specific text strings that are either within or not within a tag or tags. For example, in a document that contains the following HTML, searching for tries not inside i would find only the second instance of the word tries: John <i>tries</i> to get his work done on time, but he doesn't always succeed. He tries very hard. See Searching for text contained in specific tags.
Specific Tag lets you search for specific tags, attributes, and attribute values, such as all td tags with valign set to top. See Searching for HTML tags and attributes.
Note: Pressing Control+Enter or Shift+Enter (Windows), or Control+Return, Shift+Return, or Command+Return (Macintosh), adds line breaks within the text search fields, allowing you to search for a Return character. Be sure to deselect the Ignore Whitespace Differences option when performing this search, if you're not using regular expressions. Note that this finds a Return character in particular, not simply the occurrence of a line break; for instance, it doesn't find a <br> tag or a <p> tag. Return characters appear as spaces in the Design view, not as line breaks.
4 Use the following options to expand or limit the search:
The Match Case option limits the search to text that exactly matches the case of the text you want to find. For example, if you search for the brown derby, you will not find The Brown Derby.
Note: The Ignore Whitespace Differences option, when selected, treats all whitespace as a single space for the purposes of matching. For example, with this option selected, this text would match this text but not thistext. This option is not available when the Use Regular Expressions option is selected; you must explicitly write your regular expression to ignore whitespace. Note that <p> and <br> tags do not count as whitespace.
The Use Regular Expressions option causes certain characters and short strings (such as ?, *, \w, and \b) in your search string to be interpreted as regular expression operators. For example, a search for the b\w*\b dog will match both the black dog and the barking dog. See About regular expressions.

Note: If you are working in Code view and make changes to your document, and try to find and replace anything other than source code, a dialog box appears letting you know that Dreamweaver is synchronizing the two views before doing the search. For more information on synchronizing views, see Using the Code view (or Code inspector).