Searching Documents

HomeSite provides basic and extended search capabilities. These enable you to find and replace alphanumeric strings-including regular expressions-across folders and projects, filter the files to search by file type, select how tags are processed by the search engine, automatically replace special and extended characters with their HTML equivalents, make a double-spaced document single-spaced, select documents to edit or browse from the search results, and more. This section describes each search capability.

Selecting search text

By selecting text in a document and invoking a search, HomeSite automatically inserts the selected text into the Find what text box.

In a basic search or replace, if the selected text exceeds 100 characters, no text is inserted into the Find what box, and HomeSite searches the selected text instead of the entire document. If you want to only replace text within a selection, you can select the Selection option in the Relace dialog box.

Optionally, you can configure HomeSite so that, when you do not select any search text, it selects the word nearest to the cursor position and inserts this word into the Find what box.

To enable nearest word search selection:

Saving search text

You can reuse search strings for basic and extended searches, but the method for saving the search text differs.

To save search text, do one of the following:

To use a saved search string in a basic search:

To use a saved search string in an extended search:

  1. In the Extended Find or Extended Replace dialog box, click the arrow button next to the Find what box and select Open find text from the popup menu.
  2. In the Open find text dialog box, select the search string to use and click Open.

Using basic search commands

You can perform a basic search or replace operation on the active document, even if it is an untitled, unsaved document.

To search the current document:

  1. Select Search > Find from the menu.
  2. In the Find dialog box, in the Find what box, enter the text that you need to find.

    The last 10 items are saved in the Find what drop-down list. You can select from this list. You can also select text in the Editor to appear in the Find what box. For details, see "Selecting search text".

  3. (Optional) Select the Match whole words, Match case, and Direction options.

    To set more advanced options, perform an extended search on the current document. For instructions, see "Performing an extended search".

  4. Click the Find Next button to sequentially highlight each match in the document.
  5. If the search dialog box closes, you can press F3 to resume the search from the current cursor position in the document.

To replace text in the current document:

  1. Select Search > Replace from the menu.
  2. In the Replace dialog box, in the Find what and Replace with boxes, enter the text to find and the text to replace.

    The last 10 items are saved in the Find what and Replace what drop-down lists. You can select from these lists. You can also select text in the Editor to appear in the Find what box. For details, see "Selecting search text".

  3. (Optional) Select the Match whole words, Match case, and Direction options.

    To set more advanced options, perform an extended replace on the current document. For instructions, see "Performing an extended search".

  4. Do one of the following:

Using extended search commands

You can use the Extended Find and Extended Replace commands to perform more complex search operations across multiple documents.

Extended search and extended replace operations include untitled, unsaved documents. They are listed in the Results window by their tab label in the Editor (Untitled1, Untitled2, and so on).

The rest of this section provides instructions for performing extended search and extended search and replace operations.

Performing an extended search

This section contains instructions for performing extended searches in the current document, all open documents, in a folder, or in a project.

To perform an extended search:

  1. Select Search > Extended Find from the menu to display the Extended Find dialog box.
  2. Enter the appropriate text in the Find what box.

    To re-use a previously saved search string, see "Saving search text".

  3. In the Find where box, select one of the following options:
  4. Select any of the following options as needed:
  5. Click Find.
  6. To cancel the search operation, press the Esc key.

    The Results window displays a list of documents matching the search string.

Performing an extended replace

This section contains instructions for performing an extended search and replace operation in the current document, all open documents, in a folder, or in a project.


Caution

An extended replace operation cannot be undone. For best results, select the Make backups option. Also, an extended replace operation skips all read-only files.


To perform an extended replace:

  1. Select Search > Extended Replace from the menu to display the Extended Replace dialog box.
  2. Enter the appropriate text in the Find what and Replace with boxes.

    To re-use a previously saved search string in the Find what box, see "Saving search text".

  3. In the Find where box, select one of the following options:
  4. Select any of the following options as needed:
  5. Click Replace.
  6. To cancel the search and replace operation, press the Esc key.

    The Results window displays a list of documents in which text was replaced.

Working with the results of extended search operations

After an extended search, the Results window displays a list of documents in which the search string was found and/or replaced. You can work with these search results in many ways; for example you can edit or browse the documents in which matches were found, or view the search results list in a browser.

To edit a document for a match:

  1. Double-click a match in the results list.

    This opens the document in the Editor if it is not already open, and highlights the match in the document.

  2. Edit the file as necessary, and then save and close it.

To edit documents for more than one match:

  1. Highlight one or more matches in the search results list.
  2. Right-click the selection and select Open in Editor.

    This opens every document in which the selected matches were found, and highlights the selected matches in the documents.

  3. Edit files as necessary, and then save and close them.

To open the search results in a browser:

To clear the search results:

Replacing extended and special characters

You can replace special and extended characters in the current document with their HTML equivalents; for example, you can replace "&" with &.

To replace extended and special characters:

  1. Open the document in which to make the replacements, if it is not already open.
  2. Select Search > Replace Extended Characters from the menu.

Replacing double-spaced lines

Because of the way that different operating systems treat carriage returns, text files saved on UNIX or Macintosh systems might be double-spaced when you open them in HomeSite.

To make a double-spaced document single-spaced:

  1. Open the double-spaced document, if it is not already open.
  2. Select Search > Replace Double Spacing with Single Spacing from the menu.

    The double-spaced lines are collapsed to be single-spaced lines.

Searching with regular expressions

You can use regular expressions (or RegExp) to match patterns in character strings during Extended Find and Extended Replace operations.

To search with regular expressions:

  1. Select Search > Extended Search or Search > Extended Replace as necessary.
  2. In the Extended Find or Extended Replace dialog box, select Regular expressions.

    Enabling Regular expressions disables the Skip tags while searching option.

  3. If replacing text in a project or folder, select Make Backups and specify a backup location. If replacing in the current document or in all open documents, consider making backup copies before proceeding.
  4. In the Find what box, type the regular expression for the pattern you want to find.

    For more information, see "Using Regular Expressions".

  5. Complete the rest of the search dialog box as you would in any extended search.

    For help, see "Using extended search commands".

  6. Click the Find or Replace button, as applicable.

Comments