D
derek.google
I hope a Boost question is not too off-topic here. It seems that
upgrading to Boost 1.33 broke some old regex code that used to work. I
have reduced the problem to this simple example:
cout << boost::regex_replace(string("foo"),
boost::regex(".*"),
string("bar")) << endl;
The above code prints "barbar" where I expect "bar". Can anyone shed
some light on this? It used to work with 1.30 (though regex_replace
was called regex_merge). It seems to me that ".*" should match all of
"foo" and replace it with "bar", so where does the second "bar" in
"barbar" come from?
Through trial and error I discovered that adding boost::match_not_null
to the normal boost::match_default flag restores the desired behavior,
but I'm not sure if this is significant or just coincidence.
Derek
upgrading to Boost 1.33 broke some old regex code that used to work. I
have reduced the problem to this simple example:
cout << boost::regex_replace(string("foo"),
boost::regex(".*"),
string("bar")) << endl;
The above code prints "barbar" where I expect "bar". Can anyone shed
some light on this? It used to work with 1.30 (though regex_replace
was called regex_merge). It seems to me that ".*" should match all of
"foo" and replace it with "bar", so where does the second "bar" in
"barbar" come from?
Through trial and error I discovered that adding boost::match_not_null
to the normal boost::match_default flag restores the desired behavior,
but I'm not sure if this is significant or just coincidence.
Derek