源代码为:
boost::cmatch what;
boost::regex match_email("^(\w+((-\w+)|(\.\w+))*)\+\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$");
if(!(boost::regex_match((LPCTSTR)m_editEmail, what, match_email)))
{
afxMessageBox("邮箱填写错误");
}
无论我写的邮箱是否正确都会弹出“邮箱填写错误”的对话框,开发环境为VC6,boost库为boost_1_39_0。
boost::cmatch what;
boost::regex match_email("^(\w+((-\w+)|(\.\w+))*)\+\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$");
if(!(boost::regex_match((LPCTSTR)m_editEmail, what, match_email)))
{
afxMessageBox("邮箱填写错误");
}
无论我写的邮箱是否正确都会弹出“邮箱填写错误”的对话框,开发环境为VC6,boost库为boost_1_39_0。
你看一下boost的文档,它的正则表达式的语法是什么样的。也许是你的表达式写的不对
不同的库的正则表达式的语法不全一样