Using Sun WorkShop

Special Characters in Patterns

Although you can enter a pattern exactly as it appears in the code, you can also use special characters to specify a set of patterns. You can use the special characters in Table 3-1 in patterns.

Table 3-1 Special Characters in Patterns

Character 

 Meaning Example

Period (.) 

Matches any character 

l.nes matches all occurrences of lanes or lines.

Asterisk (*) 

Matches any number of characters, including zero or more consecutive occurrences of the character that precedes it, except when it is the first character in the pattern

file.*() matches any string that fcontains file followed by zero or more characters and (), such as traffic_file_close() and file_save_popup. *file. matches only strings that begin with file.

Circumflex (^) 

Constrains the search to match the beginning of a line 

^tr* finds all lines that begin with traffic, truck, or any other string beginning with tr.

Dollar sign ($) 

Constrains the search to match the end of a line 

lanes$ finds all the lines that end with the string lanes.

For example, suppose you want to search for window_popup in the code, but only those instances that begin a line. You would type the following query:

^window_popup*

The circumflex (^) tells the browser to look only at those matches that start a line of code, while the asterisk (*) asks for all matches with window_popup, including window_popup_name_objects and window_popup1_objects.


Note -

Surrounding an expression with a circumflex and a dollar sign constrains the search to match the entire line.