To free any allocated fields of a pattern buffer, you can use the
posix function described in Freeing POSIX Pattern Buffers,
since the type regex_t
---the type for posix pattern
buffers---is equivalent to the type re_pattern_buffer
. After
freeing a pattern buffer, you need to again compile a regular expression
in it (see GNU Regular Expression Compiling) before passing it to
a matching or searching function.