Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
With Berkeley UNIX, you can only search for a given regular
expression; you can't match one. To search for it, you must first
compile it. Before you compile it, you must indicate the regular
expression syntax you want it compiled according to by setting the
re_syntax_options (declared in `regex.h' to some
syntax (see section 2. Regular Expression Syntax).
To compile a regular expression use:
char * re_comp (char *regex)
regex is the address of a null-terminated regular expression.
re_comp uses an internal pattern buffer, so you can use only the
most recently compiled pattern buffer. This means that if you want to
use a given regular expression that you've already compiled--but it
isn't the latest one you've compiled--you'll have to recompile it. If
re_comp with the null string (not the empty
string) as the argument, it doesn't change the contents of the pattern
re_comp successfully compiles the regular expression, it
returns zero. If it can't compile the regular expression, it returns
an error string.
re_comp's error messages are identical to those
re_compile_pattern (see section 7.1.2 GNU Regular Expression Compiling).
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|