Go backward to Using Byte Offsets.
Go up to POSIX Regex Functions.

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 POSIX Regular Expression Compiling.) before
passing it to the matching function (see POSIX Matching.).