diff --git a/include/boost/regex/v4/regex_iterator.hpp b/include/boost/regex/v4/regex_iterator.hpp index 63e1447b..3a7328b2 100644 --- a/include/boost/regex/v4/regex_iterator.hpp +++ b/include/boost/regex/v4/regex_iterator.hpp @@ -63,6 +63,8 @@ public: match_flag_type f(flags); if(!what.length()) f |= regex_constants::match_not_initial_null; + if(base != next_start) + f |= regex_constants::match_not_bob; bool result = regex_search(next_start, end, what, re, f); if(result) what.set_base(base); diff --git a/include/boost/regex/v4/regex_token_iterator.hpp b/include/boost/regex/v4/regex_token_iterator.hpp index 201c2192..91aa286f 100644 --- a/include/boost/regex/v4/regex_token_iterator.hpp +++ b/include/boost/regex/v4/regex_token_iterator.hpp @@ -134,7 +134,7 @@ public: return true; } if(what.prefix().first != what[0].second) - flags |= match_prev_avail; + flags |= match_prev_avail | regex_constants::match_not_bob; BidirectionalIterator last_end(what[0].second); if(regex_search(last_end, end, what, re, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags))) {