已编译好的微软Greta 2.6.4 正则表达式库。
里面有5个文件(4个h,1个lib)
下载来直接放到要使用正则的项目里就行了。
#include
#include "regexpr2.h"
using namespace std;
using namespace regex;
#pragma comment(lib, "Greta.lib")
int main(void)
{
match_results results;
char str[256]="混淆的字符串287217977@qq.com混淆的字符串";
rpattern pat("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
match_results::backref_type br = pat.match(str, results);
if (br.matched)
{
cout << "分离出的邮箱: "<< br << endl;
}
return 0;
}
注意如果MFC项目链接遇到问题的,改为MFC静态链接
1