最近写一个远程管理的玩意,,需要用到正则表达式,,,对C++不太熟,,网上找了一些资料...
发现一个好东西,,,,只需要引用一个 头文件 就可以用了....挺方便的
#include "deelx.h"
#include <stdio.h>
int main(int argc, char * argv[])
{
char * text = "asda//,,sd.123.safasfwww.memorycat.comhhhdhwww.zixue7.comsdd/asasswww.baidu.com33232asa.3232dsdsds";
CRegexpTregexp("www\\.\\w+\\.(com|net|cc|cn)");
MatchResult result = regexp.Match(text);
while( result.IsMatched() ) {
printf("%.*s\n", result.GetEnd()-result.GetStart(),text + result.GetStart());
result = regexp.Match(text, result.GetEnd());
}
return 0;
}
下载附件 deelx.h.zip