Using Regular Expressions

Pattern Matching

Table C-1

Description of Special Characters in Regular Expressions

 

 

 

 

 

To…

Use…

Example

 

 

 

 

 

Match a range of

[-]

To match ab followed by

 

values

 

any digit, enter:

 

 

 

ab[0-9]

 

 

 

To match any digit

 

 

 

except 5, enter:

 

 

 

[1-46-9]

 

 

 

Note that if you need to

 

 

 

match the dash (-), do

 

 

 

not place it between

 

 

 

any two characters that

 

 

 

could be interpreted as

 

 

 

a range of values. For

 

 

 

example, a-zcould be

 

 

 

interpreted as a range

 

 

 

of values, while z-a

 

 

 

would not. To avoid

 

 

 

confusion, place it as

 

 

 

the first or last

 

 

 

character in your

 

 

 

string. For example, to

 

 

 

search for a dash (-),

 

 

 

followed by any digit,

 

 

 

enter:

 

 

 

[-0-9]

 

 

 

 

 

Match the

^match_expression

To match all

 

beginning of a line

 

occurrences of stack

 

 

 

that occur at the

 

 

 

beginning of a line,

 

 

 

enter:

 

 

 

^stack

 

 

 

 

358

Appendix C

Page 358
Image 358
HP UX SoftBench Software manual 358