C and C++ SoftBench User's Guide
Using Regular Expressions
Pattern Matching
Appendix C 359
Match the end of a
line
match_expression
$ To match all
occurrences of stack
that occur at the end of
a line, enter:
stack$
Match entire lines ^
match_expression
$
The following regular
expressionwouldmatch
all occurrences of
stack_push as long as
it appeared on a line by
itself:
^stack_push$
Repeat a single
character
single_character
* To match ab, followed
by any number of c's,
followed by a d (for
example, abcd, abccd,
and abcccd), enter:
abc*d
Also note that "any
number of" includes
zero occurrences of a
character. Therefore,
the string "abd" would
also match.
Repeat a
[
match_string
]
[
match_string
]* To match ab, followed
by any sequence of
digits, followed by c,
enter:
ab[0-9]*c
Table C-1 Description of Special Characters in Regular Expressions
To… Use… Example