Boost logo

Boost Users :

From: Bruno Voigt (Bruno.Voigt_at_[hidden])
Date: 2007-05-09 14:18:43


John Maddock wrote:
>> Do I have to adjust the invocation parameters of boost_merge for the
>> current version?
>>
>> I do not unnecessarily want to force the users of my production apps
>> to have to update their match patterns over dozens of cfg files from
>> "(.*)" to "^(.*)$".
>>
>> TIA for any hints,
>>
>
> I'm not sure you're going to like the answer: this is a deliberate change
> and a bug fix to make the library do the same thing as Perl etc. When
> matching "(.*)" against "abc" there are *two* matches found: one matches
> "abc" then a second match is possible against the zero-length-string at the
> end of the text. You can prevent matching null-strings altogether by
> passing match_not_null to regex_merge:
>
> boost::regex_merge(my_string, my_regex_comp, my_replace,
> boost::regex_constants::match_not_null);
>
> But that prevents all zero-length matches, which your users might not
> appreciate either :-(
>
> I can't think of an easy way to emulate the previous buggy behaviour I'm
> afraid.
>
Hi John,
At first thanks again for fast response, your lib is one of my most
precious tools.

To follow your argumentation I wrote two perl oneliners to reproduce it
and saw that only the first version with the greedy flag matches the
boost-1.33 behaviour
whilest the second version matches that of the <boost-regex-1.33 behaviour.
Is there a way to get the non greedy style with boost-regex-1.33 ?

$ perl -e '$s="123";$s=~s/(.*)/+$1/g;print $s;'
+123+

$ perl -e '$s="123";$s=~s/(.*)/+$1/;print $s;'
+123

TIA,
Bruno


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net