(Created page with "<seo title="Search and Replace Commands | vEdit" description="Learn to use the vEdit search and replace commands Search( ) and Replace( )."></seo> {{DISPLAYTITLE:Search and Re...") |
(→Searching and Search Options) |
||
| Line 5: | Line 5: | ||
This topic describes the search and replace commands '''Search( )''' and '''Replace( )''' which correspond to the functions as clicking <kbd>Search</kbd> then <kbd>Search</kbd> or clicking <kbd>Search</kbd> then <kbd>Replace</kbd>. | This topic describes the search and replace commands '''Search( )''' and '''Replace( )''' which correspond to the functions as clicking <kbd>Search</kbd> then <kbd>Search</kbd> or clicking <kbd>Search</kbd> then <kbd>Replace</kbd>. | ||
| − | + | ==Searching and Search Options== | |
The text to search for is specified with a "search string". Usually the search string consists of the exact characters you want to locate. | The text to search for is specified with a "search string". Usually the search string consists of the exact characters you want to locate. | ||
This topic describes the search and replace commands Search( ) and Replace( ) which correspond to the functions as clicking Search then Search or clicking Search then Replace.
The text to search for is specified with a "search string". Usually the search string consists of the exact characters you want to locate.
Like any string argument, the search string must be enclosed in delimiters that are not part of the search string. If the search is successful, the "edit position" is placed at the first character of the matched text, e.g. at the "t" of "today". If not, the command gives the error message "CANNOT FIND "string" - search errors can also be suppressed.
Sometimes it is preferable to have the edit position placed past the matched text, e.g. immediately after the "y" of "today". For example, this is convenient when a following block operation needs to include the matched text. This is easily done with the "ADVANCE" option.
You can directly search for the 'n'th occurrence with the command form Search("string", COUNT, n). For example:
All searches are normally forwards, toward the end of the file. However, you can also search backwards toward the beginning of the file by using the command option "REVERSE".
When searching, vEdit normally equates upper and lower case letters. However, when needed, the command option "CASE" can be used to distinguish between upper and lower case letters.
Sometimes you want to search for a distinct "word" that is separated from other characters with spaces or other separators. For example, you might want to search for the word "and", but not match "sand", "Anderson" or other words that contain "and". For this use the "WORD" option.
The search string can include any desired pattern matching codes, just like [SEARCH]. For example: (The "|" is the keyboard character above "\".)
Regular expressions can also be used when the "REGEXP" option is specified.