Set HTML rules for finding text

The Find and Replace dialog box supports HTML rules in searches and has advanced HTML tag and attribute options. By using HTML rules in your search, you can determine where and under what conditions to search your code. For example, you can create an HTML rule to search text only inside a tag. Text outside of the tag would be excluded from search results.

To set HTML rules for finding tags

  1. Do one of the following:

    • To search within a single page, open the page.

    • To search all pages in a site, open the site.

    • To search in one or more pages in a site, in either the Folder List panel or the Site View, select the pages that you want to search.

    • To search in one or more pages in a site, open the pages that you want to search.

  2. On the Edit menu, do one of the following:

    • To find but not replace text, click Find.

    • To find and replace text, click Replace.

  3. In the Find and Replace dialog box, click HTML Rules.

  4. In the HTML Rules dialog box, do any of the following:

    • To add a rule, click New rule. In the New rule box, type or select the tag you want to find. In the Replace action box, select a criterion. Set the options for the criterion.

    • To delete a rule, select the rule and click Delete rule.

    • To delete all rules, click Delete all.

      Tip

      To remove all HTML rules, in the Find and Replace dialog box, click Clear rules.

      Use this To do this

      With Attribute

      Find the text or tag only if it is in a tag with an attribute. For example, you can search for all instances of "Arial" and limit your search to only those tags that include a specific attribute.

      Without Attribute

      Find the text or tag only if it is in a tag without an attribute. For example, you can search for all instances of "p" and limit your search to only those tags that do not include a specific attribute.

      Containing

      Find the text or tag only if it is in another tag or text that you specify. For example, you can search for all instances of the font <font> tag that are nested in a bold <b> tag.

      Not Containing

      Find the text or tag only if it is not in another tag or text that you specify. For example, you can search for all instances of the table <table> tag that are not nested in another tag.

      Inside Tag

      Find the text or tag only if it is in a tag that you specify. For example, you can search for all instances of the word "font" and all instances of the font <font> tag will be in your search results.

      Not Inside Tag

      Find the text or tag only if it is not in a tag that you specify. For example, you can search for all instances of the word "font" and instances of the font <font> tag will not be in your search results.

See also

Tasks

Edit multiple pages with find and replace
Find and replace tags
Use the thesaurus

Concepts

Regular expressions for finding text

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.