|
Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate |
|
Toolbox for WordPerfect |
||
|
Macros, tips, and
templates for Corel® WordPerfect® for Windows® |
Page updated Oct 13, 2009 | |
|
WordPerfect Tips Main tips page | Browse tips |
|
|
How to efficiently use "Find:" in the Find and Replace (F&R) dialog Related pages - Enhancing the Find and Replace feature REPLACEM - Replace multiple words in one pass |
Most often you probably just type a word or phrase into the Find field, (possibly) make various selections from the Find and Replace dialog's menu (also see Tips below), then either search for the item with one of the Find buttons or replace the item in the document with whatever you typed into the Replace field. Alternatively, you can
In most cases these two alternatives will not present a problem. Keep it short! As with manually typing words into the F&R field, pre-selecting words, or copying a selection and then pasting it into the field is limited by the program to just 79 characters and spaces. If your intent is to search for a selection of text in the document that is longer than 79 characters/spaces, this can present problems. (Not to mention that it probably is unnecessary to use such long strings in a simple find operation!) The "disappearing text" effect One issue is that if you pre-select text that has more than 79 characters, WordPerfect will simply ignore it and not put it in the Find field. This might cause you to wonder why it didn't work when it often worked in the past (with shorter selections). The reason WordPerfect ignores such larger blocks of selected material is that it assumes you want to search in the selection, not search for the selection. In fact, it will enable "Search in Selection" in the F&R Options menu. It then waits for you to type something in the Find field (it may already have placed the previous search material there). This is "working as designed," and it might be what you want to do some of the time. Just be aware of what WordPerfect assumes you want to do depending on the size of your selection of material. To search for words in the document, keep the selection short. Otherwise,WordPerfect will set things up to search inside the selection for whatever you type in the Find field. The "truncation effect" Another issue: "Characters" in the context of selecting material also means WordPerfect symbols and format codes. So if you copy a short selected block of text that contains these codes, these items are counted toward the 79 "character" limit when you paste them into the Find field (or let WordPerfect automatically insert them in the Find field with alternative #1 above). Therefore, the sentence might become truncated (cut off at the end) in the Find field. Since the F&R field is relatively small, you might not notice this with a long sentence, and therefore you might not replace what you expect to replace when your click Replace or Replace All. Moreover, as with merely selecting large blocks of text, copying and pasting a selection larger that 79 characters/codes also causes WordPerfect to enable "Search in Selection" in the F&R Options menu. This is probably not what you want. Again, it is best to keep your selections short unless you really intend to search inside the selection itself. [Incidentally, finding and replacing large blocks of text in often-used documents can be done with text variables.] An alternative One way to work around the truncation effect problem (other than to remember to keep selections shortet than 79 characters/codes) is to first paste the copied selection elsewhere in the document (or in a blank document) without any format codes by using Edit, Paste Special, Unformatted text (see here for more). Then re-select and re-copy the item, then paste the now unformatted version into the Find field. Again, this might only be needed for sentences that approach 79 characters -- counting any embedded codes. What about macro searches? Note that macro search routines are also limited to 79 characters in a SearchString() command; however, storing a selection of text in a macro variable automatically strips out any format codes. The Search (and Replace, if used) operation will succeed since it looks for only the characters and spaces -- up to the 79 character limit, of course. See the footnote below for a code snippet to test for the length of a selected string.
|
|
For macro writers: One way to alert the user of a macro that searches for selected text that the selection is too long is to use something like the following snippet in the macro's code after the point where some text has been selected:
|
|