📄 test.c
字号:
// $extern\test.c 1.5 milbo$ test.c: test gnu regexp// Warning: this is raw research code -- expect it to be quite messy.#include <stdlib.h>#include <stdio.h>#include "config.h"#include "regex.h"static char *string = "abc";static char *pattern = "C$|x"; // will match case insensitive "C$" on final "c" in "abc"int __cdecl main (void){int cflags = REG_EXTENDED|REG_ICASE|REG_NOSUB; /* egrep style expression, ignore case, simple failure reporting in regexec */int i;regex_t preg;printf("pattern %s string %s: ", pattern, string);i = regcomp(&preg, pattern, cflags);if (i) printf("regcomp failed, returned %d\n", i);else { regmatch_t pmatch[1]; i = regexec(&preg, string, 0, pmatch, 0); printf("%s\n", i == 0? "match": "no match"); regfree(&preg); }return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -