2.boost的正则库比较难用,这里只是其中一个简单的使用例子。
-- boost库里的dll都是可以单独使用的。这里只用了 libboost_regex-mgw44-1_46_1.dll
[cpp]
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
printf("Hello, world\n");
std::string in("my is test ! ... ..'");
boost::regex e1("'");
std::string result = boost::regex_replace(in,e1,"\'", boost::match_default | boost::format_all);
std::cout << result << std::endl;
return 0;
}
输出
[plain]
$ test.exe
Hello, world
my is test ! ... ..'