REGEX(3)

NAME
regex - regular expression interface

SYNOPSIS
    #include <regex.h>
    int        regcomp(regex_t* re, const char* regex, int cflags);
    int        regexec(const regex_t* re, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags);
    size_t     regerror(int code, const regex_t* re, char* errbuf, size_t errbuf_size);
    void       regfree(regex_t* re);
    regclass_t regclass(const char* str, char** end);
    int        regaddclass(const char* name, regclass_t classf);
    int        regcollate(const char* str, char** end, char* buf, int size);
    int        regcomb(regex_t* re_1, regex_t* re_2);
    int        regdup(regex_t* re_old, regex_t* re_new);
    regstat_t* regstat(const regex_t* re);
    regex_t*   regcache(const char* pattern, regflags_t flags, int* pcode);
    int        regncomp(regex_t* re, const char* pattern, size_t size, regflags_t flags);
    int        regnexec(const regex_t* re, const char* subject, size_t size, size_t nmatch, regmatch_t* match, regflags_t flags);
    int        regrecord(const regex_t* re);
    int        regrexec(const regex_t* re, const char* buf, size_t size, size_t nmatch, regmatch_t* match, regflags_t flags, int sep, void* handle, regrecord_t recordf);
    void       regfatal(regex_t* re, int level, int code);
    void       regfatalpat(regex_t* re, int level, int code, const char* pattern);
    int        regsubflags(regex_t* re, const char* str, char** end, int delim, const regflags_t* map, int* pm, regflags_t* pf);
    void       regsubfree(regex_t* re);

DESCRIPTION
and are the POSIX regular expression functions. The remaining functions are ast extensions. ast also provides flags extensions to the functions and code extensions to the function.

maintains a cache of compiled regular expressions for patterns of size 255 bytes or less. The initial cache size is 8. and are passed to with an pointer maintained by if not 0, points to the return value of the call. If the call fails, returns 0 and will point to the non-zero error code. Do not call on the returned by Both and are used to match entries in the cache. When the cache is full the least recently used is freed (via to make space for the new pattern. Any previously returned by may be freed (invalidated) on the next call to If is longer that 255 bytes then it is still passed on to but it will not be cached. If is 0 then the cache is flushed. In addition, if the integer value of is greater than the current cache size, the cache size is increased to that integer value. 0 is always returned when is 0; will point to a non-zero value on error.

SEE ALSO
strmatch(3)