Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Finding and Replacing Text

The Find Command

The “Find” command can be invoked 3 ways:

  • By selecting Edit -> Find... from the menubar

  • You can use the keyboard shortcut: Ctrl + F

  • By clicking on the toolbar.

When the Find Command is invoked, a dialog appears.



Basic Text Search

The combo 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 Find , then KWord 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 matches found for "Text to find" .

Tip

If you want to repeat a recent search, simply select the arrow in the drop-down box and a list of your most recent searches will appear. Simply select your search from the list and click Find .

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.

Regular Expressions in KWord

The default action for KWord is to search for an exact match of the text. KWord has the ability to match text that follows a pattern or a set of rules.

To enable patterns, place a mark in the box labeled Regular expression .

This will enable the Edit button. This button can be a quick way to create regular expressions for people unfamiliar with UNIX� regular expressions.

A more thourough discussion of regular expressions in KDE can be found in the help manual for KRegExpEditor, which can be found in the KHelpCenter.

Formatting options

KWord also has the ability to search your document for text that matches certain formatting options as well as the text itself.

To include formatting options in your search, click the button labeled Show Formatting Options .

Once Show Formatting Options has been clicked, a new dialog will appear.



You can use this dialog to select the options you want to include in your search.

The left column consists of 13 check boxes. If there is a mark in the check box, then KWord will evaluate any searchable text for that property. If no mark is in the check box, KWord does not consider that property when performing a search.

Family:

Use this combo box to select the font family you want to include in your search text.

Size:

Use this spin box to set the font size you want KWord to search for.

Color: and Background color:

Clicking on either of these two buttons allows you to select the font color and/or background color respectively, you want KWord to search for. For more information on selecting a color, see the section on Selecting Colors from the Color Dialog.

Bold: and Italic:

Use these Yes / No radio boxes to determine whether you want KWord to include boldface or italicized fonts in the search text.

Strikeout:

You can select None , Single , Double or Simple Bold to modify your search.

Underline:

You can select None , Single , Double , Simple Bold or Wave to modify your search.

Vertical alignment:

You can select Normal , Subscript or Superscript to determine what font alignment you want KWord to search for.

Shadow: and Word by word:

Use these Yes / No radio boxes to determine whether you want KWord to include shadow text in the search text and whether to search for word by word underlining and strikethrough text.

Capitalization:

You can select Normal , Uppercase , Lowercase , or Small Caps to determine what capitalization you want KWord to search for.

Language:

You can select the language of the text you want KWord to search for using this dropdown box.

Once you have selected your options, click OK to accept your search options.

Click Cancel to ignore all changes.

Click Reset to restore the options dialog box to the default values.

Click Clear to remove all marks from the checked options.

Other Search options

In addition to pattern matching, you can limit the search results with a few useful 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 .

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.

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 .

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.

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 position of the cursor. The direction that KWord searches is, by default forward in the document, but can be changed with the Find backwards option.

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 menubar

  • You can use the keyboard shortcut: Ctrl + R

When the Replace command is invoked, a dialog appears.



Basic Search and Replace

The combo 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 )

You can enter your replacement text in the text box labeled Replacement text: . You can now click OK to replace all occurrences 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.

Regular Expressions in KWord

The default action for KWord is to search for an exact match of the text. KWord has the ability to match text that follows a pattern or a set of rules.

To enable patterns, place a mark in the box labeled Regular expression .

This will enable the Edit button. This button can be a quick way to create regular expressions for people unfamiliar with UNIX� regular expressions.

A more thourough discussion of regular expressions in KDE can be found in the help manual for KRegExpEditor, which can be found in the KHelpCenter.

Formatting options

KWord also has the ability to search your document for text that matches certain formatting options as well as the text itself.

To include formatting options in your search, click the button labeled Show Formatting Options .

Once Show Formatting Options has been clicked, a new dialog will appear.



You can use this dialog to select the options you want to include in your search.

The left column consists of 13 check boxes. If there is a mark in the check box, then KWord will evaluate any searchable text for that property. If no mark is in the check box, KWord does not consider that property when performing a search.

Family:

Use this combo box to select the font family you want to include in your search text.

Size:

Use this spin box to set the font size you want KWord to search for.

Color: and Background color:

Clicking on either of these two buttons allows you to select the font color and/or background color respectively, you want KWord to search for. For more information on selecting a color, see the section on Selecting Colors from the Color Dialog.

Bold: and Italic:

Use these Yes / No radio boxes to determine whether you want KWord to include boldface or italicized fonts in the search text.

Strikeout:

You can select None , Single , Double or Simple Bold to modify your search.

Underline:

You can select None , Single , Double , Simple Bold or Wave to modify your search.

Vertical alignment:

You can select Normal , Subscript or Superscript to determine what font alignment you want KWord to search for.

Shadow: and Word by word:

Use these Yes / No radio boxes to determine whether you want KWord to include shadow text in the search text and whether to search for word by word underlining and strikethrough text.

Capitalization:

You can select Normal , Uppercase , Lowercase , or Small Caps to determine what capitalization you want KWord to search for.

Language:

You can select the language of the text you want KWord to search for using this dropdown box.

Once you have selected your options, click OK to accept your search options.

Click Cancel to ignore all changes.

Click Reset to restore the options dialog box to the default values.

Click Clear to remove all marks from the checked options.

Other Search options

In addition to pattern matching, you can limit the search results with a few useful 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 .

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.

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 .

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.

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 position of the cursor. The direction that KWord searches is, by default forward in the document, but can be changed with the Find backwards option.

Once you have selected your options, click OK to accept your search options.

Click Cancel to ignore all changes.

Click Reset to restore the options dialog box to the default values.

Click Clear to remove all marks from the checked options.

Replace with formatted text

KWord also has the ability to replace the found text with formatted text.

To include formatting options in your search, click the button labeled Show Formatting Options in the Replace With section.

Once Show Formatting Options has been clicked, a new dialog will appear.



You can use this dialog to select the format of the replaced text.

The left column consists of 13 check boxes. If there is a mark in the check box, then KWord will change any replaced text to match the property selected. If no mark is in the check box, KWord does not consider that property when replacing text.

Family:

Use this combo box to select the font family you want your replacement text to use.

Size:

Use this spin box to set the font size you want KWord to use for your replaced text.

Color: and Background color:

Clicking on either of these two buttons allows you to select the font color and/or background color respectively, you want KWord to use. For more information on selecting a color, see the section on Selecting Colors from the Color Dialog.

Bold: and Italic:

Use these Yes / No radio boxes to determine whether you want KWord to change the fonts to boldface or italicized fonts.

Strikeout:

You can select None , Single , Double or Simple Bold to use for the replacement text.

Underline:

You can select None , Single , Double , Simple Bold or Wave to use for the replacement text.

Vertical alignment:

You can select Normal , Subscript or Superscript to determine what font alignment you want KWord to use.

Shadow: and Word by word:

Use these Yes / No radio boxes to determine whether you want KWord to use shadow text and/or word by word underlining and strikethrough in the replacement text.

Capitalization:

You can select Normal , Uppercase , Lowercase , or Small Caps to determine what capitalization to use for the replacement text.

Language:

You can select the language of the text you will use to replace the found text.

Once you have selected your options, click OK to accept your text options.

Click Cancel to ignore all changes.

Click Reset to restore the options dialog box to the initial values prior to making any changes.

Click Clear to remove all marks from the checked options.

Using placeholders

Placeholders are useful when you want to add text to complex search strings. Currently KWord has only one placeholder: Complete text string .

This placeholder will contain the entire text string matched by the Find command.

For example:

You create a search string, using regular expressions: Reference \d

Note

In order for this string example to work, a mark must be placed in the check box labeled Regular expression

Regular expressions are available by placing a mark in this checkbox. The use of regular expressions is beyond the scope of this manual. For more information see the KDE Regular Expression Manual (Available in the KDE help center).

Now in the Replace With section of the replace dialog, you place a mark in the check box labeled Use placeholders . Click the Insert Placeholder button and select Complete Match . KWord will insert a \0 in the Replacement text: text box.

Now surround the placeholder with parentheses, so your text string is: (\0)

When this is executed, whenever KWord encounters the find text (ie. “Reference 0”, “Reference 1”, “Reference 2”, etc) it will surround the text in parenthesis (“(Reference 0)”, “(Reference 1)”, “(Reference 2)”, respectively).

As you can see, the placeholder will maintain a copy of the search text. You can use this placeholder to add text to the ends of any search string you can imagine.

Other Replace Options

Additional options in the dialog are:

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 .

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.

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 .

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.

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 position of the cursor. The direction that KWord searches is, by default forward in the document, but can be changed with the Find backwards option.

Prompt on replace

If this option is selected, KWord will prompt the user before each replacement. This allows you to approve or disapprove each replacement.




 
 
  Published under the terms of the GNU General Public License Design by Interspire