xref: /titanic_44/usr/src/lib/libast/common/man/regex.3 (revision de6732348404877079e00a1631babd13d8a5ad14)
.fp 5 B .. .nr ;G \\n(.f .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" \\*(;G .. .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" ..

0

..

..

REGEX 3
NAME
regex - regular expression interface
SYNOPSIS
.EX #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); size_t regdecomp(regex_t* re, regflags_t flags, char* buf, size_t size); 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 regsubcomp(regex_t* re, const char* str, const regflags_t* map, int minmatch, regflags_t flags); int regsubexec(const regex_t* re, const char* subject, size_t nmatch, regmatch_t* match); 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
.LR regcomp() , .LR regexec() , .LR regerror() , and .L regfree() are the POSIX regular expression functions. The remaining functions are ast extensions. ast also provides flags extensions to the .LR regcomp() , .LR regexec() functions and code extensions to the .L regerror() function.

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

"SEE ALSO"
strmatch(3)