例子1: #include stdio.h> #include string.h> #include pcre.h> /********************************************************************** *#include * *parameters: src: string * * pattern: regular expression * *return: match >= 0 and nomatch int fun_ismatch( char* src, char* pattern) { pcre *re; const char *error; int erroffset; int rc; if( (re = pcre_compile...
by 大隐隐于床 - Linux文档专区 - 2009-04-18 20:54:24 阅读(1964) 回复(0)
本帖最后由 FightForWin 于 2011-03-11 14:13 编辑 大家好:我要在字符串中匹配 /abc? eev= 这两个串。 源串可能的形式为 GET /abc?eev=http://txt? 或 GET /abc?xx=yy&eev=htp://txt? 其实就是除了要匹配 /abc? 外还要匹配 eev= 其中eev前面要么没有其他字符,如GET /abc?eev=http://txt? 要么是取地址符,如GET /abc?xx=yy&eev=htp://txt? 请教大家,怎么写正则表达式,谢谢。 编辑原因:一开始把字符串弄错了,不好意...
我把文件上传到tmp,然后执行[code] tar -zxvf pcre-8.33.tar.gz cd pcre-8.33 ./configure make && make install [/code]有三个疑问,安装完,是否可以删除tmp/pcre-8.33的文件夹 【不同这一点和windows有何不同】 第二,安装完之后,pcre是跑到哪个目录了 第三,如果要卸载,如何卸
没看懂下句的意思,网上只说?是启用扩展匹配,没找到详细的说明,哪位大侠给个链接? preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/u'
不明白为什么使用pcre 6.4会提示下面这种错误 [quote] g++ -I/home/down/pcre-6.4/ -I/home/ext/pcre/include/ -I./ -L/home/ext/pcre/lib/ -lpcre re.cpp rg.cpp -o rg re.cpp: In member function `const Regexp& Regexp::operator=(const std::string&)': re.cpp:53: error: invalid use of undefined type `struct real_pcre' /home/down/pcre-6.4/pcre.h:164: error: forward declaration of `struct real_pcre' re.cpp: In ...
302 pcre *re; 303 const char *error; 304 int erroffset; 305 int rc; 306 char pattern[KRK_MAX_HTTP_EXPECTED+1] = {0,}; 307 308 memcpy(pattern, hcp->expected, hcp->expected_len); 309 310 re = pcre_compile(pattern, pcre_CASELESS, &error, &erroffset, NULL); 311 if (re == NULL) { 312 fprintf(stderr,"compile pcre failed\n"); 313 return KRK_ERROR; 314 ...
302 pcre *re; 303 const char *error; 304 int erroffset; 305 int rc; 306 char pattern[KRK_MAX_HTTP_EXPECTED+1] = {0,}; 307 308 memcpy(pattern, hcp->expected, hcp->expected_len); 309 310 re = pcre_compile(pattern, pcre_CASELESS, &error, &erroffset, NULL); 311 if (re == NULL) { 312 fprintf(stderr,"compile pcre failed\n"); 313 return KRK_ERROR; 314 ...
[code]/*
* g++ pcre2.cpp -I/usr/local/include -L/usr/local/lib -R/usr/local/lib -lpcre++ -lpcre
*/
#include
Ubuntu 12.04 LTS 通过apt-get install libpcre3 libpcre3-dev安装pcre,安装后,pcre.h在/usr/include/pcre.h 程序中,#include <pcre.h> gcc -Wall -I/usr/include -I/usr/local/include -L/lib -L/usr/lib -L/usr/local/lib -lpcre 5.c,有如下提示: 5.c:(.text+0x54): undefined reference to `pcre_compile' 5.c:(.text+0x7d): undefined reference to `pcre_study' 5.c:(.text+0xf2): undefined reference to `pcre_exec...
比如源字符串: char src [] = "111