Go to the previous, next section.

Freeing POSIX Pattern Buffers

To free any allocated fields of a pattern buffer, use:

void 
regfree (regex_t *preg)

preg is the pattern buffer whose allocated fields you want freed. regfree also sets preg's allocated and used fields to zero. After freeing a pattern buffer, you need to again compile a regular expression in it (see section POSIX Regular Expression Compiling) before passing it to the matching function (see section POSIX Matching).

Go to the previous, next section.