Regular Expressions

The set of regular expressions that the debugger supports for matching symbols is similar to the set supported by UNIX grep. The debugger set includes a few enhancements.

Following are the wildcards:

Wildcard Description
. Matches any single character.
[ ] Defines a character class; matches a set or range of characters.
^ Negates a character class.

Following are the postfix operators:

Operator Description
* Causes the previous wildcard or single character to match zero or more characters.
# Matches zero or one.
+ Plus sign, matches one or more.

Anywhere a symbol is accepted, a regular expression can be used. If there is more than one match, a list of matching symbols is displayed and you must select the proper symbol. The symbol match is not case-sensitive.

The asterisk (*), number sign (#), and plus sign (+) are already math expression operators. To be recognized as a regular expression operator, each of these characters must be immediately preceded by an escape character — the backslash (\). The period (.), opening bracket ([), and closing bracket (]) do not require escape characters. Anything inside the brackets of a character class does not have to be escaped. Following are valid character classes:

[a-z]
[;*+#]
 

Characters are escaped at two levels: in the expression evaluator and in the regular expression parser. A character special to the expression evaluator (*, #, +, or \) must be escaped to make it to the regular expression parser. If a character special to the regular expression parser must be escaped (for example, to match symbols with * or # in them), it must be escaped twice. If a backslash is needed in an expression, it must be double escaped.

Following are sample regular expressions:

Regular expression Description
sym.\* Matches any symbols beginning with the string sym.
sym\* Matches sym alone and sym followed by any characters.
.\*sym.\* Matches any symbols containing the string sym.
sym[0–9] Matches sym0, sym1, sym2, and so on.
sym\\\* Matches sym*.
sym\\\\ Matches sym\.
sym\\\\.\* Matches any symbols beginning with the string sym\.