The above work in the UNIX command line, and in vi
How about pattern matching from within a C program?
There are two useful functions in
that provide the following prototype functions
char* re_comp (char*);
int re_exec (char*);
To be useful pattern matching must be very fast, so the raw
text form of the regular expressions require some parsing
to convert them to a more efficient representation.
It is re_comp()that does this.
The function used to actually do the matching of the regular
expression pattern against the contents of the string is
called re_exec().
|