|
|
(for pattern matching)
strcmp (char*, char*)can be used for exact matching of
strings, but often we want to find substrings that conform
to certain constraints.
Regular expressions specify a pattern to be sought in an
array of characters. We can define our regular expression
and then ask the system if particular strings conform to it.
Regular expressions are found throughout the UNIX
environment, both at the command line (through grep--Get
Regular ExPression), and through system calls from within
user programs.
A few single character-matching codes
|
|
|
|
[abc]a, b or c are matched
[d-k]any of d, e, f, g, h, i, j or k are matched
|
|
|
|
|