Searching & Replacing Features. Robelle Solutions Technology Inc. Qedit for Windows 5.9.13
Advertisement
Advertisement
Searching & Replacing Features
Overview
Qedit gives you immediate search results, even with enormous host files. This is because Qedit actually performs host file searches on the server, not the client. When
Qedit finds a string match, it downloads only the portions of the file that contain the match. That’s why Qedit is so fast. Qedit also provides you with numerous search criteria: embedded words, highlighted words, pattern matching, as well as a partial file search. Qedit’s replace option further enhances the search capabilities.
Scrolling Through a File
You can scroll through a file either horizontally or vertically. There are several basic ways to scroll through a file: use the scroll bar, use cursor movement keys, or use the wheel of an intelligent mouse. Each document window has both a horizontal and vertical scroll bar.
Qedit for Windows User Manual Searching & Replacing Features
• 135
Scroll arrow
Scroll box
Vertical scroll bar
Scroll arrow Scroll box
Vertical and horizontal scroll bars
Horizontal scroll bar
Using the Scroll Bars
The vertical scroll bar is located on the right side of a document window. A scroll bar consists of scroll arrows at either end of the bar and the scroll box that moves along the bar. Just as in other applications, it allows you to scroll up and down in a file. The distance you move in a file depends on how you use the scroll bar or how far you move the scroll box.
If you click a scroll arrow, you will move one line at a time. If you drag the scroll box, you can move multiple pages. If you click the scroll bar itself between the scroll box and either of the arrows, you move up or down by one page. The status bar always indicates the line number of your current position.
If your file is wider than your document window, you can scroll left or right by using the horizontal scroll bar located at the bottom of the window. It works the same way as the vertical scroll bar, except it moves left and right.
Using the Intelligent Mouse
If your mouse has a wheel as well as the usual buttons, you have an “intelligent” mouse. The wheel provides an easy way to scroll through a file without moving your pointer to one of the scroll bars. Simply rotate the wheel to move the displayed text.
Qedit recognizes this scrolling method. You can adjust the speed of the scroll by setting the Mousewheel Acceleration slider in the Preferences dialog box. If you bring the slider all the way to the left, Qedit scrolls slowly for each turn of the wheel. If you bring the slider to the right, Qedit scrolls quickly.
136
• Searching & Replacing Features
Qedit for Windows User Manual
Using Cursor Movement Keys
Another way to move through a file is to use cursor movement keys. Your PC keyboard has the following eight cursor movement keys:
To move
one line up
Press this key
↑ one line down one character left one character right
↓
←
→ beginning of the line end of the line one page up less one line
Home
End
Page Up one page down less one line Page Down
Cursor movement keys can be combined with other keys to provide other shortcuts.
See “Key Combinations and Functions” on page 200.
Setting Markers in a File
Shortcut:
F11
key
Shortcut: F12 key
Shortcut: CTRL+F11
Marking a Position
For each document, Qedit can save up to the last 10 markers at a time. These markers can be an insertion point or a block of selected text. Qedit uses a Last
In/First Out (LIFO) stack to save these markers. To mark a position, select the Save
position command in the Mark menu.
For example, if you put markers on lines 2, 10 and 8, and then go to line 20, the cursor returns to line 8, 10 and 2, respectively, when you use the Go to previous
position command consecutively.
If you save more than 10 markers in the file, you will lose the oldest marker. You will also lose a marker if you delete or cut-and-paste the text in which a marker is located.
Returning to a Marked Position
Although you can save up to 10 markers in a file, you can return only to the previously saved marker in the list each time you select the Go to previous
position command in the Mark menu. If you have not saved a marker, this command is unavailable. If you want to mark the position to which the caret returned, you have to use the Save position command again.
Exchanging Current Position with Last Marker
To return to the last marker without losing your current position, you can use the
Exchange position command in the Mark menu. This switches your insertion point with the last saved marker, as if you had used Save position and Go to
previous position simultaneously.
Qedit for Windows User Manual Searching & Replacing Features
• 137
Shortcut: Shift+F12
Using the Last Marker to Select Text
Use the Select to Saved Position command to quickly select text between the insertion point and the position of the last marker. Find the start of the block and save the position with the Save Position (
F11
) command. Find the end of the block anyway you like (scroll, jump, search) and use Select to Saved Position.
Qedit automatically selects the text between the insertion point and the last marker.
Defining the Terms of a Search
Qedit for Windows provides you with a range of terms to search within a file: pattern matching with substitution characters, case-sensitive matching, searching whole or partial words.
The search functions are as consistent with Windows as possible, but there are some which derive from the experience of Qedit on the host (e.g., pattern matching). If you don't have access to the host-based programs, Qedit for HP e3000 or Qedit for
HP-UX, review the corresponding documentation for more details.
You can change the default settings of the search options at any time. This allows you to customize your search and give you the best results. To define the terms of a search,
1. Select Find in the Edit menu.
2. When the Find String dialog box appears, define the terms of your search:
Find String dialog box
• Search for
Qedit saves the last 15 search requests you have done. This includes the search string and all options. If you want to recall a search request, scroll through the list using the up or down arrow keys.
If you select some text before calling the dialog box, the selected text is automatically used as a search string unless the previous search used the
Match pattern or Regular Expression options.
• Ignore case
Matches the string whether it is in lowercase, uppercase, or mixed case in the file.
138
• Searching & Replacing Features
Qedit for Windows User Manual
• Match pattern
Matches patterns of characters instead of specific characters. For example,
@bob@green@ matches any occurrence of the string bob anywhere in a line, followed by zero or more intervening characters and then the string
green. The pattern match control characters are the same as those used in the standard host-based Qedit.
The following characters can be used for other specific pattern searches:
@ at sign matches zero or more characters of any type
# number sign matches exactly one numeric character (0-9)
?
question mark matches exactly one alphabetic character (a-z, A-Z)
~ tilde matches zero or more space characters
& ampersand matches the next character (use &@ to look for an @ sign)
^! circumflex and exclamation point are reserved use $^ and $! to match them
• Regular expression
Regular expressions use powerful syntax allowing precise definitions of your string search. Regular expressions have been around for a long time and are now available on almost any platform. For syntax details, refer to
"Appendix C – Regular Expression" on page 243. Note that server version 4.8
or higher is required.
• Smart search (whole words)
Search for whole words and ignore embedded words, such as cell in excellent. Once enabled, this option will not change until you disable it.
The Smart search also depends on the Qedit Language setting. For example, in COBOL a word can contain a hyphen character, so word does not match word-option.
• Range
You can limit the search to a specific section of the file, specify the starting point of the search, and the columns to search.
3. When you have finished selecting your options, you can proceed in the following three ways:
• Click Search Forward to search from the specified starting point towards the end of the file or Search Reverse to search from the specified starting point towards the beginning of the file.
• Click Don’t Search to save the search options, but not perform the search.
• Click Cancel to return to the previous search options and not perform the search.
Common Search Operations
Finding Consecutive Occurrences of a String
To search for a text string,
Qedit for Windows User Manual Searching & Replacing Features
• 139
Shortcut: CTRL+F
Toolbar:
Find Previous is on the left and Find Next is on the right.
1. Select the Find command in the Edit menu.
2. When the Find String dialog box appears, define the terms of your search. See
“Defining the Terms of a Search” above for a list of terms.
3. Click Search Reverse or Search Forward to perform the search operation.
If Qedit finds a match, it highlights the first occurrence of the string and displays the page around it.
To repeat the same search for the next occurrence of the string, use the Find Again command in the Edit menu or use the
CTRL
+
G
shortcut. To find the next occurrence, use the Find Next tool.
To find the previous occurrence, use the Find Previous command of the Edit menu, use the Find previous tool, or type the
CTRL
+
R
shortcut.
Shortcut: CTRL+F
Toolbar:
Finding the First and Last Occurrence of a String
To find the first or last occurrence of a string in a file,
1. Select the Find command in the Edit menu.
2. To find the first or last occurrence of a string in a file, enable the Entire file option instead of the From current location option.
3. Define the remaining terms of your search. See “Defining the Terms of a
Search” above for a list of terms.
4. Click Search Reverse or Search Forward to perform the search operation.
If Entire file is enabled and you select Select Reverse, Qedit finds the last occurrence of the string. If you select Select Forward, Qedit finds the first occurrence of the string.
Finding a Highlighted Word
To find the next occurrence of a highlighted word, use the Find "highlighted" command in the Edit menu. To find the previous occurrence of a highlighted word, use the Find previous "highlighted" command in the Edit menu. These commands use the terms defined in the last Find operation.
NOTE: The Find previous and Find next buttons always look for the last string defined in a search operation, not the currently highlighted text.
Limiting a Search to Part of a File
To limit a search operation to part of a file,
1. Highlight the section you want to search.
2. Select the Find command in the Edit menu.
3. When the Find String dialog box appears, you will see a new option in the
Range box: Selection Only replaces From current location. Enable this new option.
140
• Searching & Replacing Features
Qedit for Windows User Manual
Shortcut: CTRL+J
The Line number and Record number options are available only for files that have both.
4. Define the remaining terms of your search. See “Defining the Terms of a
Search” above for a list of terms.
5. Click Search Reverse or Search Forward to perform the search operation.
Search Forward finds the first occurrence of the string in the selection.
Search Reverse finds the last occurrence in the selection.
Searching in Columns
To search for a string in certain columns of a file, enable the Search in columns option and enter the column numbers in the appropriate text boxes. Column numbers are relative to the Language of the file. For most languages, the first column is one.
For others, such as COBOL, the first column is seven.
The left column number is required but the right column is optional. If the right column number is not specified, Qedit assumes the search starts at the left column and continues to the end of the line. The column numbers specified are inclusive.
That is, if you enter five as the left column and seven as the right column, Qedit searches three columns: five, six and seven.
Finding a Line Number in a Host File
Lines in a file are identified by numbers. All files, local and host, have relative numbers also known as record numbers. That is, lines are numbered from one and incremented by one.
In addition to record numbers, host files often have absolute line numbers. That is, each line has explicit sequence numbers that are stored in ASCII. Absolute line numbers do not necessarily match the line position relative to the file. For example, line number 100 might actually be the 150 th
line of the file. Absolute line numbers can also have up to three decimals (e.g., 15.25, 217.147).
Although Qedit does not display line numbers in host files, it does allow you to find one. This is very useful when you are working on a server report, such as compiler errors output, which refers to lines by their absolute line number.
To find an absolute line number, select the Goto line command in the Mark menu.
Qedit for Windows User Manual
Go To Line dialog box with absolute line number option
When the Go To Line dialog box appears, enter the line number and click OK.
Qedit automatically selects the Line number option if the file is numbered. If the file is unnumbered, Record Number is selected.
Searching & Replacing Features
• 141
Shortcut: CTRL+J
Finding a Record Number
Lines in a file can also be referenced by a number relative to the beginning of the file. These ordinal numbers, which are called record numbers, are available in all
Qedit files. To find a record number in a file, use the Goto line command in the
Mark menu, enter the desired number and, if given a choice, enable the Record
number option. For more information, see “Record Numbers” on page 127.
You can also move around in host files using absolute line numbers.
Common Replace Operations
Qedit’s search functions are further enhanced with a replace function. Combined, search and replace can provide you with powerful editing capabilities necessary for global changes to a file.
Shortcut: ALT+E,R
Replacing Occurrences of a String
To find occurrences of a string from a certain point and replace them with another string,
1. Select the Replace command in the Edit menu.
2. When the Replace dialog box appears, enter the string you want to find in the
Search for text box and the new string in the Replace with text box.
Replace dialog box
3. Define the terms of your search operation. You get the same search options as on a Find command.
If you have not limited your search to selected text, the default start position of the search is the cursor’s current position. Qedit finds all occurrences of the string from that point to the end of the file and replaces them.
If you have limited your search to selected text, Qedit replaces the string only in the selection.
4. Click Replace to perform the operation.
142
• Searching & Replacing Features
Qedit for Windows User Manual
Replacing All Occurrences of a String
To replace all occurrences of a string in a file, select the Replace command in the
Edit menu. When the Replace dialog box appears, enable the Entire File option in the Range box. In this case, Qedit finds all occurrences of the Search for string defined by the terms of your search, and replace them with the new string in the
Replace with text box.
Replacing a String Based on Pattern Matching
You can use the Match Pattern option to search for generic strings. Although this can be powerful, it can also be dangerous. Let’s say there is a file with the following sentence:
Start walking and you will get home in the end.
You can enter “@Start@end@” in the Search for text box and “Wrong Way!” in the Replace with text box, enable Match Pattern and select Replace. Qedit will search for a line that has the words “Start” and “End” anywhere, with any number of characters before, in between or after. Qedit then puts the replacement string, starting on the position of the S in “Start” all the way to the d in “End.” In this example, the whole sentence gets replaced with “Wrong Way!”
Replacing a String Using Regular Expressions
Just as a pattern match can be used in a Replace operation, you can also use regular expressions. Qedit replaces the whole string matching the regular expression.
Regular expressions offer additional functionality in the replacement string. The feature is known as backreference substitution. This allows extraction of regular expression subpatterns from the original text and re-insert them in the replacement string.
Customizing Your Search Options
The caret, cursor and the insertion point are all the same thing.
Allowing the Caret in Undefined Areas
Normally, Qedit does not allow the cursor anywhere to the right of the last character on a line. If you try to enter a character in this area, Qedit automatically moves the cursor to the right-most character on the line. This is Qedit’s way of preventing an accidental extension of a line in files where spaces at the end of a line are significant.
You can change Qedit’s default so that it automatically extends spaces between the last character on the line and a newly inserted character or a
RETURN
key beyond the last character. Simply select Preferences from the Options menu. When the
Qedit Preferences dialog box appears, enable Caret allowed in undefined
areas. When this option is enabled, you will be able to put the insertion point beyond the last character of a line.
If you browse through a file while this option is enabled, the cursor remains in the same column no matter where the text ends in a line. Qedit does not adjust left or right. If the option is disabled, however, Qedit keeps the cursor in the same column only if the text extends that far. For shorter lines, the cursor is moved to the end of text, adjusting left or right as needed to always keep the text and cursor visible.
Qedit for Windows User Manual Searching & Replacing Features
• 143
If you start typing while the cursor is in the undefined area, Qedit automatically fills the area up to that point with blanks. If you also have enabled Preserve trailing
blanks, you might start getting error messages as you insert text.
Automatically Marking Successful Searches
To make it easier to move around in a file, you can set markers using the Save
position command of the Mark menu. When the Automatically save position
on search option on the Searching page of the Preferences dialog box is enabled, Qedit automatically marks a position after a successful Find operation, if the search string is different than the previous one.
Scrolling Method for Host Files
Depending on your network or PC, scrolling through host files using the scroll box can be slow. This is because Qedit is requesting new lines from the server as you move the scroll box. You might not actually need these lines, however, so Qedit now provides the Use live scrolling for server files option of the Preferences menu.
By default, this live scrolling option is disabled. This means Qedit will not request new lines from the server until you release the scroll box. While you move the scroll box, Qedit displays the record number corresponding approximately to that location in the file. The record number appears in a box to the left of the scroll bar. Also, the text already displayed in the window does not change or move until you release the scroll box.
The record number appears in a small box during passive scrolling.
When enabled, Qedit requests lines as you move the scroll box. If you have a fast network or if most of the file is already in the cache, you will not see any delays. The text in the document window will move up and down as you move the scroll box.
144
• Searching & Replacing Features
Qedit for Windows User Manual
Setting Default Search Options
You can save your favorite search options (Search entire file, Ignore case,
Smart search) as the default settings for a Find operation. To set your defaults, select Preferences in the Options menu. When the Preferences dialog box appears, enable your choice of options in Search Defaults box.
Search options have three different settings. If an option is disabled (e.g., Smart
search), the corresponding option in the Find String dialog box will also be disabled. If an option is enabled (e.g., Ignore case), the corresponding option in the dialog box will also be enabled. If an option appears dimmed (e.g., Search
entire file), the corresponding option in the dialog box will use the setting in the previous search.
Qedit for Windows User Manual Searching & Replacing Features
• 145
Download
Advertisement