regex c语言

最近一直在补习c语言的底子功夫,关于正则表达式的c教程,看了man手册感觉还不错。

REGEX(3) Linux Programmer's Manual REGEX(3)

NAME
regcomp, regexec, regerror, regfree - POSIX regex functions

SYNOPSIS
#include <sys/types.h>
#include <regex.h>

int regcomp(regex_t *preg, const char *regex, int cflags);

int regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags);

size_t regerror(int errcode, const regex_t *preg, char *errbuf,
size_t errbuf_size);

void regfree(regex_t *preg);

 

如果还不够

另外

https://www.jianshu.com/p/9cda6b29a12b

http://blog.chinaunix.net/uid-20448327-id-3189854.html

也可以看看,我就是不明白为啥子“\\b”就不行了,估计是有个bug,不过我用[0-9]代替了,无伤大雅

posted @ 2018-02-02 23:45  looking weather  阅读(209)  评论(0编辑  收藏  举报