Searching Text, Code, or Tags
Beyond the standard find and replace functions, you’d expect, Expression Web also lets you search and replace bits of your code across an entire Web site. That can be especially handy when trying to track down problems. The Find and Replace dialog box’s many options make it easy to zero in on even the tiniest bit of code across the largest of sites. It also includes an option to search and change just HTML tags.
To find text or code on a single page:
- To search a single page, open it or select it in the Folder List.
- Choose Edit > Find ().
- In the Find and Replace dialog box, type what you’re searching for in the Find what field or click the field’s drop-down menu and choose an appropriate item (Figure 4.53).
Figure 4.53 In the Find and Replace dialog box, you can use the Find what field’s drop-down menu or type in your own text.
- Use the Search options pane to specify where to look, the direction of the search, or such things as the case of the item.
If you click Find Next, the search item is highlighted (Figure 4.54). The page remains visible, enabling you to use the Find Next button to move through the page.
Figure 4.54 The search item is highlighted in the page (top). Click the Next button to move through the page.
or
If you click Find All, the first instance of the search item is highlighted in the page and the Find and Replace dialog box is replaced by the Find pane listing all the instances found. Click the Find pane’s blue Next or Back arrows to continue searching the page. To close the Find pane, click the X in the pane’s title bar.
To find text or code across the site:
Open the site you want to search, and select its name in the Folder List (Figure 4.55).
Figure 4.55 To search an entire site, select its name in the Folder List.
- Choose Edit > Find.
In the Find and Replace dialog box, type in the Find what box the term you’re searching for or use the field’s drop-down menu to choose an appropriate item. If necessary, use the Advanced pane to further hone the search. Click Find All (Figure 4.56).
Figure 4.56 Type in the Find what box the term you’re searching for, use the Advanced pane to further hone the search, and click Find All.
A Find pane lists the search results by page, line number, and context (Figure 4.57).
Figure 4.57 A Find pane lists the search results by page, line number, and context.
Click the Find pane’s blue Next result arrow, and Expression Web automatically opens the page containing the search term and highlights it in context (Figure 4.58).
Figure 4.58 Click the Find pane’s Next arrow, and the page containing the term opens automatically.
- Click the Find pane’s blue Next result arrow to see the next instance of the search term, or click the blue Back arrow to see the previous instance. To close the Find pane, click the X in the pane’s title bar.
To find and replace HTML tags:
- In the Folder List, select the entire site, single page, or multiple pages (using -click) in which you want to find a particular HTML tag, and choose Edit > Find.
In the Find and Replace dialog box, select the HTML Tags tab. Set up what you want to find and replace using the Find tag, Replace action, and To drop-down menus (Figure 4.59).
Figure 4.59 In the HTML Tags tab, set up what you want to find and replace using the Find tag, Replace action, and To drop-down menus.
- If you want, use the Find where section of the Search options pane to expand or narrow the pages searched and the Advanced section to further hone the search. Since Expression Web cannot undo a replace-all action, click Find All (not Replace All).
When the Find pane displays the search results, look through the Matched Text column to see if Expression Web found what you wanted. If you have any doubts, select the page listing and click the blue Next result arrow (Figure 4.60). The page opens so that you can get a better look.
Figure 4.60 When the Find pane displays the search results, look through the Matched Text column to see if Expression Web found what you wanted.
Once you’ve taken a good look at the results, click the green arrow at the top of the Find pane (Figure 4.61).
Figure 4.61 Click the arrow at the top of the Find pane to return to the Find and Replace dialog box.
The Find and Replace dialog box reappears.
(Optional) If necessary, you can adjust the find and replace actions and then, if you’re being extra careful, select Find 2 in the Display results in section (Figure 4.62). Click Find All again, and a second tab appears in the Find pane (Figure 4.63). Switch between the two tabs to compare the results. Repeat step 5 to return to the Find and Replace dialog box until you’re satisfied with the results. Then return to the Find and Replace dialog box one last time.
Figure 4.62 You can adjust the find and replace actions and display the results in a new pane by selecting Find 2.
Figure 4.63 By switching the Find 1 and Find 2 tabs, you can compare the results of both searches.
Click Replace All in the Find and Replace dialog box (Figure 4.64). Assuming you’ve doubled-checked your work, click Yes when the alert dialog box appears (Figure 4.65).
Figure 4.64 Since the action cannot be reversed, make sure you’re ready before clicking Replace All.
Figure 4.65 Assuming you’ve doubled-checked your work, click Yes.
Expression Web makes the replacements and lists the actions in the Find pane (Figure 4.66).
Figure 4.66 Expression Web makes the replacements and lists the actions in the Find pane.