3
在Perl中,我能做到這一點我如何知道boost :: regex_replace是否進行了更改?
if($str =~ s/a/b/) {
do something
}
在C++中,我知道該怎麼做查找/替換部分:
str = boost::regex_replace(str, boost::regex("a"), "b",
boost::match_default | boost::format_perl) ;
我怎麼知道是否有替換的話?
我可以比較舊的價值和新的價值。有沒有更好的辦法?
+1對於似乎不被「接受」的正確答案, – cppanda