爲什麼這塊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++標準regex庫。
最後我聽說libstdC++的''不完整。 [看到這個相關問題的答案。](http://stackoverflow.com/a/12665408/445976) –
Blastfurnace
使用boost正則表達式庫 – flyingfoxlee