VS2008 SP1自带的正则表达式

时间:2022-09-12 23:14:50
#include <regex>

std::tr1::wregex reg(L"\[(\w+)\]");
std::tr1::wsmatch results;
std::wstring search_string(L"[sWamplek3fj]");
std::tr1::regex_match(search_string, results, reg);
TRACE(L"result=%s ", results[1].str().c_str());

VS2008 SP1中使用正则表达式和方法和BOOST库中是基本上一样的,主要要注意域的不同,BOOST中的域是boost::, 而在Feature Pack中的域是std::tr1::

VS2008 SP1自带的正则表达式