使用带有std :: tr1 :: regex的多行

时间:2014-01-04 19:58:27

标签: c++ regex replace comments multiline

我有一个很棒的正则表达式,可以删除c / c ++样式的注释。

std::tr1::regex rx1( "//.*?$|/\\*.*?\\*/|\\'(?:\\\\.|[^\\\\\\'])*\\'|\"(?:\\\\.|[^\\\\\"])*" );
str = std::regex_replace( str, rx1, std::string("") );

唯一的问题是它只匹配一行。如何在所有行上使用std :: tr1 :: regex进行匹配?

0 个答案:

没有答案