Find & Replace Dialog

The Find & Replace dialog (in the Search menu, and also Edit>Find>Find & Replace) finds and replaces a word or phrase in the current field. The replacement will occur in all selected records (not just the current record). For example, you can use this dialog to replace every occurrence of Inc. to Incorporated, or every occurrence of Purchase Order to P.O.. This example will find every occurence of the word rd in the database and replace it with road (and since the Entire Words option is checked, the replacement will have the same capitalization). For a search string like rd, it is essential to specify the Entire Words option, otherwise an address like 27 Hardware Lane would be changed to 27 Haroadware Lane.

Note: No matter how many times rd appears in this field, every occurrence will be replaced. Even if rd occurs multiple times in a cell, all of them will be replaced.

#### Undo

It’s easy to make a mistake with the Find & Replace dialog that causes a potentially catastrophic change. Fortunately, the Undo command can undo any damage, just as with virtually all other Panorama commands.

#### Replace Options

The Option pop-up menu customizes how text is replaced.

Each option is described below.

##### Exact Characters

With this option, you specify the exact text to be replaced (including upper and lower case), and the exact replacement text (also including upper and lower case). Panorama will replace the text even if it is part of a larger word or phrase. For example, if you ask Panorama to exactly replace is with was, it will also change this to thwas, thistle to thwastle and isis to waswas. It will not, however, replace Is, IS, or THIS.

##### Entire Words Only

This is the default option. When this option is used, Panorama will only replace entire words. With this option selected, if you ask Panorama to exactly replace is with was it will not change this to thwas or thistle to thwastle.

When the Entire Words Only option is used, Panorama is smart about replacing upper and lower case text – it automatically matches the case of the replaced text. For example, if you ask it to replace inc with incorporated, it will automatically adjust the capitalization of the replacement text, as shown here.

    inc ☞ incorporated
    Inc ☞ Incorporated
    INC ☞ INCORPORATED

If the the replacement word has unusual capitalization, for example MacDonald, use the Entire Words Only (Case Sensitive) option. This disables the automatic capitalization feature.

##### Regular Expression

This powerful option allows you to use a regular expression to specify what text should be replaced (see Regular Expressions). To demonstrate this, consider this database where numbered streets like 7th, 34th, and 127th are incorrectly capitalized. With a regular expression, this can be fixed without messing up street names like Third Street or Thorton Avenue. The regular expression matches one or more numeric digits, followed by `Th`, followed by a word break (a space or the end of the address).

The replacement string includes the numeric digits (thru the use of the $1 capture group) followed by `th`. When the Replace button is pressed, the addresses are fixed throughout the database.

Mastering regular expressions takes some effort, but the payoff can be huge.

Note: If you want to do this type of replacement in a program, use the formulafill statement with the regexreplace( or regexreplaceexact( function.

##### All Fields

The Find & Replace dialog normally replaces text only within the current field. If the All Fields option is checked, the operation will occur in every field in the database. Obviously you need to be careful when using this option to avoid unintended changes. Use the Undo command if something changed that you didn’t want changed.

See Also

- checkemptyselection -- notifies the user if a selection failed, and reverts to the previous selection.
- Date Search Options -- searching dates within a database.
- Favorite Searches -- saving and recalling favorite searches.
- find -- locates the first visible record in the active database for which the specified condition is true.
- Find/Select Dialog -- using a dialog to search for specific data.
- findabove -- locates the next previous record (above the current record) in the active database for which the specified condition is true.
- findbackwards -- locates the last visible record in the active database for which the specified condition is true.
- findbelow -- locates the next visible record (below the current record) in the active database for which the specified condition is true.
- findid -- locates a record in the active database by its ID number (see info("serverrecordid").
- findnth -- finds the nth (2nd, 3rd, 4th, etc.) record that matches a true-false test.
- findselect -- opens the standard *Find/Select* dialog.
- findselectdialog -- opens the standard *Find/Select* dialog.
- Formula Search -- searching with a formula.
- Handling Empty Selections in Code -- dealing with an empty selection data set.
- ifselect -- combines the select and if info("empty") operations into a single statement.
- info("empty") -- returns true or false depending on the result of the last select operation. If no records were selected the function will return true, otherwise it will return false.
- info("found") -- returns true or false depending on whether the last *find* or *next* statement was successful.
- info("selectduplicatesortwarning") -- works with the selectduplicatesnowarning statement to ascertain whether or not the database was sorted correctly when last search for duplicates was performed.
- nextmatch -- locates the next visible record in the active database for which the condition specified in the most recent Find statement is true.
- Numeric Search Options -- searching numbers within a database.
- pleaseselectall -- makes sure that all records are selected.
- previousmatch -- locates the previous (closer to the top) visible record in the active database for which the condition specified in the most recent Find statement is true.
- Record Search Options -- searching via record attributes.
- Refining a Selection -- selecting a subset or superset of a previous selection."
- removeselected -- deletes all selected records from the database.
- removeunselected -- deletes all unselected records from the database.
- safeselect -- makes visible only those records for the active database for which the specified condition is true. If no records match, the previous selection is retained.
- safeselectwithin -- makes visible only those previously selected records in the active database for which the specified condition is true. If no records match, the previous selection is retained.
- search( -- searches through an item of text looking for a character, word or phrase. If it finds an exact match (including upper/lower case) with the character, word or phrase, it returns its position within the text item. If it does not find the character, word or phrase, it returns zero.
- searchanycase( -- searches through an item of text looking for a character, word or phrase. If it finds a match (upper/lower case may be different) with the character, word or phrase, it returns its position within the text item. If it does not find the character, word or phrase, it returns zero.
- Searching -- searching a database to find or select information.
- select -- makes visible only those records for the active database for which the specified condition is true.
- Select Duplicates Dialog -- opens the standard *Select Duplicates* dialog sheet.
- selectadditional -- adds unselected records to a previously selected group if they match the true-false test.
- selectall -- makes every record in the database visible.
- selectduplicates -- selects records containing duplicate information in the database.
- selectduplicatesnowarning -- selects records containing duplicate information in the database.
- Selecting with the Context Menu -- searching for information related to the current cell.
- selectreverse -- makes every visible record invisible, and every invisible record visible.
- selectwithin -- uses a Boolean formula to exclude records from a previously selected group.
- Text Search Options -- searching text within a database.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, now includes regular expressions and the ability to work across all fields.