While using regex_iterator template in our build2 toolchain project we have discovered that for some regular expressions the end iterator can never be reached. The issue can be reproduced with the following code: std::string s ("foo"); std::regex re (".*"); using it = std::regex_iterator<std::string::const_iterator>; for (it i (s.begin (), s.end (), re), e; i != e; ++i) ; // Hangs.
If you change your regex to '.+' (match at least one character), it works fine.
You right. Unfortunately, in our case regexes come from the end user, so we unable to amend them.
Fixed in revision 307171