
Hi All, I've just started to use boost::regex I met with the following incompatibility with Perl regular expressions: It is impossible to use empty expressions, neither alone nor inside of another regex statement. Sample code: #include <iostream> #include <boost/regex.hpp> void check_regexp(const char * text) { try { boost::regex e("(\\d+)\\s*(kbit|)"); boost::cmatch what; if (boost::regex_match(text, what, e)) { std::string item1(what[1].first, what[1].second); std::string item2(what[2].first, what[2].second); std::cout << "matched. " << std::endl << "Value : " << item1 << std::endl << "Units : " << item2 << std::endl << std::endl; } } catch (boost::regex_error & e) { std::cout << "ERROR: " << e.what() << std::endl; } } int main(int argc, char** argv) { check_regexp("96 kbit"); } Program output: ERROR: Empty expression Such regular expressions are quite legal in Perl (e.g. /(Ann|Bob|)/) One possible (quick-n-dirty) workaround for this is to replace boost::regex e("(\\d+)\\s*(kbit|)"); with boost::regex e("(\\d+)\\s*(kbit|.{0})"); Program output would be: matched. Value : 96 Units : kbit Would it be considered as an issue for further improvement? Thank you. -- impulse9