Finding and Replacing Text

Finding and Replacing Text

The Find Command

The ‘Find’ command can be invoked 3 ways:

  • By selecting Edit->Find... from the Menu bar

  • You can use the keyboard shortcut:Ctrl+F

  • By clicking on the toolbar.

When the Find Command is invoked, a dialog appears.

The drop-down box labelled Text to Find, provides a place for you to enter the text of your search command. In the screenshot, that box is currently filled with KDE)

If you click on OK, then KDE will search the document until it finds a match to your text. If KWord cannot find a match, a dialog box will appear that says No match found.

Refining Your Search

KWord's find feature is much more sophisticated than we discussed above. Using the options in the dialog box, you can narrow down your search to find exactly what you want.

Pattern Matching

The default action for KWord is to search for an exact match of the text. Fortunatly, however, KWord has the ability to match text according to patterns.

To enable patterns, place a mark in the box labeld Use Patterns.

This will enable the Insert Pattern button. This button can be a quick way to add patterns for people unfamiliar with UNIX® pattern matching.

Note

You do not need to use the Insert Pattern button, to insert your text string. You can type it into the search line. The Insert Pattern button is a convenience for people unfamiliar with pattern matching.

You should now type the text in place, stopping to insert the pattern elements where necessary.

For specific information on pattern matching, take a look at the section entitled Pattern Matching

Other Search options

In addition to pattern matching, you can limit the search results with a few miscellaneous options.

Case Sensitive

When this option is selected, KWord will not only search for the string of letters, but will verify that the case of the letters is the same. For example. Searching for: KDE

will match: KDE and hiddenKDEinwords but not: Kde, kde or hiddenkdeinwords.

Whole words only

When this option is selected, KWord will only return search items that are surrounded by spaces, paragraph marks or punctuation. For example. Searching for: KDE

will match: KDE

but not: hiddenKDEinwords or KDElike.

From Cursor

By default, KWord begins searching at the beginning of the document. If this option is selected, KWord begins its search from the current possition of the cursor. The direction that KWord searches is, by default forward in the document, but can be changed with the Find Backwards option.

Find backwards

This option changes the direction of the search. This can be useful when you only want to search for a string of text before the current cursor position, not after. This option is usually used in conjunction with From Cursor, but if that option is not specified, KWord will start searching from the end of the document backwards.

Selected Text

If you want to limit your search to a specific part of the document (a few paragraphs, for example), you can select the part of the document you want to search prior to selecting the Find command. When text is selected, KWord will default to only searching the selected text. You can use this option to enable or disable this restriction.

Note

This option will not be available if you have not selected text prior to selecting the Find command.

The Replace Command

The replace command is an extension of the find command. If you are familiar with the find command, you will see many similarities.

The Replace command can be invoked 2 ways:

  • By selecting Edit->Replace... from the Menu bar

  • You can use the keyboard shortcut: Ctrl+R

When the Replace command is invoked, a dialog appears.

The drop-down box labeled Text to Find, provides a place for you to enter the text of your search command. In the screenshot, that box is currently filled with KDE)

Entering Replacement Text

You can enter your replacement text in the text box labeled Replacement Text. You can now click OK to replace all occurences in the document, or you can further refine your search.

Refining Your Search

KWord's find feature is much more sophisticated than we discussed above. Using the options in the dialog box, you can narrow down your search to find exactly what you want.

Pattern Matching

The default action for KWord is to search for an exact match of the text. Fortunatly, however, KWord has the ability to match text according to patterns.

To enable patterns, place a mark in the box labeld Use Patterns.

This will enable the Insert Pattern button. This button can be a quick way to add patterns for people unfamiliar with UNIX® pattern matching.

Note

You do not need to use the Insert Pattern button, to insert your text string. You can type it into the search line. The Insert Pattern button is a convenience for people unfamiliar with pattern matching.

For specific information on pattern matching, take a look at the section entitled Pattern Matching

Other Replace Options

In addition to pattern matching, you can limit the search results with a few miscellaneous options.

Case Sensitive

When this option is selected, KWord will not only search for the string of letters, but will verify that the case of the letters is the same. For example. Searching for: KDE

will match: KDE and hiddenKDEinwords but not: Kde, kde or hiddenkdeinwords.

Whole words only

When this option is selected, KWord will only return search items that are surrounded by spaces, paragraph marks or punctuation. For example. Searching for: KDE

will match: KDE

but not: hiddenKDEinwords or KDElike.

From Cursor

By default, KWord begins searching at the beginning of the document. If this option is selected, KWord begins its search from the current possition of the cursor. The direction that KWord searches is, by default forward in the document, but can be changed with the Find Backwards option.

Find backwards

This option changes the direction of the search. This can be useful when you only want to search for a string of text before the current cursor position, not after. This option is usually used in conjunction with From Cursor, but if that option is not specified, KWord will start searching from the end of the document backwards.

Selected Text

If you want to limit your search to a specific part of the document (a few paragraphs, for example), you can select the part of the document you want to search prior to selecting the Find command. When text is selected, KWord will default to only searching the selected text. You can use this option to enable or disable this restriction.

Note

This option will not be available if you have not selected text prior to selecting the Find command.

Pattern Matching

Any Character

Will find any letter, number, punctuation or symbol.

KDE Logo