我有以下C ++代码,工作正常:
#include <regex>
#include <iostream>
#include <string>
int main () {
std::string str("mymail@yahoo.com;lslsls;myemail@gmail.com");
std::tr1::regex rx("([a-zA-Z0-9_\\.]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4})");
std::tr1::sregex_iterator first(str.begin(), str.end(), rx);
std::tr1::sregex_iterator last;
for (auto it = first; it != last; ++it)
{
std::cout << "[Email] => " << it->str(1) << std::endl;
}
return 0;
}
有一种简单的方法可以使用本机库在C ANSI(* .cpp - &gt; * .c)中获得此功能吗?我正在使用MS Visual Studio 2010。