// 本示例是提取Email
void RegularEmail(wstring& str_in, vector<wstring>& vStr_out)
{
vStr_out.clear();//[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-.]+
//wregex regRule(L"[a-zA-Z0-9_.+-]+@[a-pr-zA-PRZ0-9-]+.[a-zA-Z0-9-.]+");
wregex regRule(L"[a-zA-Z_0-9-]+(\\.[a-zA-Z0-9-]+)*@([a-zA-Z0-9](-[a-zA-Z0-9])?)+(\\.{1,2}[a-zA-Z-0-9]+)+");
wsmatch matchResult;
wstring::const_iterator iterStart = str_in.cbegin();
wstring::const_iterator iterEnd = str_in.cend();
//
while (regex_search(str_in, matchResult, regRule))
{
vStr_out.push_back(matchResult._At(0));
str_in = matchResult.suffix(); // 指向查找结果的下一个位置,继续查找
}
}