int nOptions = PCRE_EXTENDED | PCRE_UTF8;
const char *pError;
int nErroffset;
// 构造pcre结构
pcre *pRe = pcre_compile(
sRulesUtf_8.c_str(),
nOptions,
&pError, /* for error message */
&nErroffset, /* for error offset */
NULL); /* use default character tables */
std::vector<std::wstring> sPcreOut;
int nPos = 0;
int nRet = 1;
while(pRe && nRet > 0)
{
int ovector[30]; // 必须为3的整数倍
memset(&ovector, -1, sizeof(ovector));
// 执行正则表达式匹配
nRet = pcre_exec(
pRe, /* the compiled pattern */
NULL, /* no extra data - we didn't study the pattern */
sSrcRealUtf_8.c_str(),//subject, /* the subject string */
(int)sSrcRealUtf_8.size(), /* the length of the subject */
nPos, /* start at offset 0 in the subject */
0, /* default options */
ovector, /* output vector for substring information */
sizeof(ovector) / sizeof(ovector[0])); /* number of elements in the output vector */