Boost logo

Boost Users :

From: Andrew Holden (aholden_at_[hidden])
Date: 2007-11-14 15:24:57


Maximilian Wilson wrote:
> It seems counter-intuitive to me that consuming an entire string
should leave
> an empty string behind. After all, after that empty string is
consumed, there's
> still another empty string, and another, etc.

I agree. However, the following Perl program demonstrates the same
behavior, so it isn't just Boost.Regex. Since Boost.Regex attempts to
emulate Perl by default, this "bug" is correct.

#Begin Perl sample
#! /usr/bin/perl

$v = 'Test';
$v =~ s/(.*)/R_$1/g;
print "$v\n"; #Prints "R_TestR_"
#End Perl sample

Now that I think about it, didn't Boost.Regex change the default mode
from POSIX to Perl between 1.32 and 1.33? Perhaps you can recover the
old behavior by constructing the regex object as 'boost::regex ("(.*)",
boost::regex::extended)' or 'boost::regex ("(.*)",
boost::regex::basic)'. I can't remember which one was the default in
boost 1.32.

As a side note, please avoid posting HTML messages. They cause havoc
with many mail readers.


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