/ [[regexp]]
regexp
Searches for the first line containing this regular expression. If omitted, the command searches for the next occurrence of the last regular expression given.
The Search (/) command searches for a regular expression in a source file.
“Regular expressions” are patterns of characters that may match one or many different strings. The use of patterns to match more than one string is similar to the MS-DOS method of using wild card characters in filenames.
CodeView's regular expressions use a subset of the UNIX syntax supported by the Programmer's WorkBench (PWB). For complete information on regular expressions in PWB and CodeView, see Appendix A.
When you enter the Search command with a regular expression, CodeView searches the source file for the first line containing the expression. If you do not give a regular expression, CodeView searches for the next occurrence of the last regular expression specified.
Even if you do not understand regular expressions, you can still use the Search command with plain text strings, since text strings are the simplest form of regular expressions. For example, you can enter
>/ COUNT
to search for the word COUNT in the source file.
To find strings containing a special regular expression character ( .\^$*[] ), you must precede the character with a backslash (\); this cancels their special meanings. For example, use the command:
>/ x\*y
to find the string x*y.
In Source windows, CodeView starts searching at the current cursor position and places the cursor at the line containing the regular expression. The search wraps to the beginning of the file if necessary.
In addition to typing the / command, you can also search for regular expressions by choosing Find from the Search menu.
When you search for the next occurrence of a regular expression, CodeView searches to the end of the file, then wraps around and begins again at the start of the file. This search can have unexpected results if the expression occurs only once. For example, when you give the command repeatedly, there is no activity on the screen. Actually, CodeView is repeatedly wrapping around and finding the same expression each time.
The Case Sensitivity command on the Options menu and the Options Case Sense (OC) command affect regular expression searches.
If you want to find a label in your source code, you can also use the View Source (VS) command.