id summary reporter owner description type status milestone component version severity resolution keywords cc 4103 erase_all_regex does not work well with possibly empty strings. Paolo Bolzoni Marshall Clow "Here is a test case, I want to remove all the substrings that matches the regular expression '`\s*`': all spaces, tabs and similars. {{{ $ cat test_case.cc #include #include #include boost::regex const& spaces() { static boost::regex rv(""\\s*""); return rv; } int main() { std::string e1("" Leading spaces! Remove them all! ""); std::string c1(e1); std::string e2(""No trailing or leading... Remove them all!""); std::string c2(e2); boost::erase_all_regex(e1, spaces()); std::cout << ""Erased: -"" << e1 << ""-"" << std::endl; std::cout << ""Original: -"" << c1 << ""-"" << std::endl; std::cout << std::endl; boost::erase_all_regex(e2, spaces()); std::cout << ""Erased: -"" << e2 << ""-"" << std::endl; std::cout << ""Original: -"" << c2 << ""-"" << std::endl; } $ g++ -lboost_regex -W -Wall -pedantic -o test_case test_case.cc $ ./test_case Erased: -Leading spaces! Remove them all! - Original: - Leading spaces! Remove them all! - Erased: -No trailing or leading... Remove them all!- Original: -No trailing or leading... Remove them all!- $ }}} I think the expected output should not have spaces in the output string. Instead only the leading spaces are removed. While the problem still persist with '`\s*`' the bug apparead also with regex '`\s+`' in the version 1.41, but using the svn trunk downloaded yesterday it disappeared. It is worth to note because the bug is not very grave anymore. It is enough to use a regex that does not allow empty strings. " Bugs closed Boost 1.43.0 algorithm Boost Development Trunk Problem wontfix