Syntax
#include <sys/types.h> #include <regex.h> void regfree(regex_t *preg);Description
regfree frees any memory that was allocated by regcomp to implement the regular expression preg. After the call to regfree, the expression defined by preg is no longer a compiled regular or extended expression.
Regular expressions are described in "Regular Expressions" in the VisualAge C++ Programming Guide.
There is no return value.
This example compiles an extended regular expression and frees it.
#include <sys/types.h> #include <regex.h> #include <stdio.h> #include <stdlib.h> int main(void) { regex_t preg; char *pattern = ".*(simple).*"; int rc; if (0 != (rc = regcomp(&preg, pattern, REG_EXTENDED))) { printf("regcomp() failed, returning nonzero (%d)\n", rc); exit(EXIT_FAILURE); } regfree(&preg); printf("Memory allocated for reg is freed.\n"); return 0; /**************************************************************************** The output should be similar to : Memory allocated for reg is freed. ****************************************************************************/ }Related Information