为什么这段 C++ 代码会永远阻塞?
string word = " a\n";
regex indent("^( |\t)*");
word = regex_replace(word, indent, "");
为什么这段 C++ 代码会很快终止?
string word = " a\n";
regex indent("^( |\t)+");
word = regex_replace(word, indent, "");
再加上一个转折,为什么这会很快终止?
string word = " a\n";
regex indent("^( |\t)+?");
word = regex_replace(word, indent, "");
我希望这"^( |\t)+?"
与"^( |\t)*"
我正在使用 libc++ 和 llvm 以及标准的 c++ 正则表达式库。