Using Regular Expressions

Pattern Matching

Table C-1

Description of Special Characters in Regular Expressions

 

 

 

 

 

To…

Use…

Example

 

 

 

 

 

Specify a list of

[valid_values]

To match either stack

 

valid matching

 

or stock, enter:

 

values.

 

st[ao]ck

 

 

 

 

 

 

To specify the string ab,

 

 

 

followed by any digit

 

 

 

except 5, enter:

 

 

 

ab[012346789]

 

 

 

Note that to treat an

 

 

 

opening or closing

 

 

 

bracket as a literal

 

 

 

string, it must be the

 

 

 

first character after the

 

 

 

opening bracket. For

 

 

 

example, to match all

 

 

 

the occurrences of ab]

 

 

 

and ab6, enter:

 

 

 

ab[]6]

 

 

 

To match all

 

 

 

occurrences of ab[ and

 

 

 

ab6, enter:

 

 

 

ab[[6]

 

 

 

 

356

Appendix C