Exa*_*gon 3 c++ regex string c++11
我试图编写一个类似于 Java 的Matcher::replaceFirst(String replacement). 我知道如何更换所有比赛中std::string,有std::regex_replace,但我怎么能只替换字符串中的正则表达式的第一场比赛?
Matcher::replaceFirst(String replacement)
std::string
std::regex_replace
小智 5
您可以使用std::regex_replace附加标志std::regex_constants::format_first_only, 来获得您想要的结果。
std::regex_constants::format_first_only
查看http://en.cppreference.com/w/cpp/regex/regex_replace以获取更多信息。
归档时间:
9 年,8 月 前
查看次数:
846 次
最近记录:
5 年,3 月 前