Linux C函数库参考手册之正则表达式函数

regcomp(编译正则表达式字符串)

#include <sys/types.h>
#include <regex.h>
int regcomp(regex_t *preg, const char *regex, int cflags);

regerror(取得正则搜索的错误原因)

#include <sys/types.h>
#include <regex.h>
size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size);

regexec(进行正则表达式的搜索)

#include <sys/types.h>
#include <regex.h>
int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);

regfree(释放正则表达式使用的内存)

#include <sys/types.h>
#include <regex.h>
void regfree(regex_t *preg);

Leave a Reply

Your email address will not be published. Required fields are marked *