Boost logo

Boost Users :

From: Bruno.Voigt_at_[hidden]
Date: 2007-05-09 11:27:14


Hi all,
I have a problem with an application build with the current debian/etch
libboost-regex lib.
I am not sure if the problem results from an intended behaviour change of
the regex lib
or if its a bug of either the regex lib or the debian package.

The following test app worked flawlessly with several older boost regex
versions
and I would like to understand why it doesn't work anymore using the lib
from debian/etch.

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,
Bruno

--
bruno.voigt_at_[hidden]
// debian/etch: dpkg -l *boost*
// ii  libboost-dev                 1.33.1-10      Boost C++ Libraries 
development files
// ii  libboost-regex-dev           1.33.1-10      regular expression 
library for C++
// ii  libboost-regex1.33.1         1.33.1-10      regular expression 
library for C++
// ii  libboost-thread-dev          1.33.1-10      portable C++ 
multi-threading
// ii  libboost-thread1.33.1        1.33.1-10      portable C++ 
multi-threading
//
// build: g++ -lboost_regex regex_merge_test.cpp
//
#include <cstdlib>
#include <string>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
using namespace std;
int main(void)
{
    string my_regex("(.*)"); // doesnt't work (worked with previous boost 
regex versions)
    //string my_regex("^(.*)$"); // works
    string my_replace("\\+$1");
    string my_string("123");
    try {
        boost::regex my_regex_comp(my_regex);
        try {
            string my_result = boost::regex_merge(my_string, 
my_regex_comp, my_replace);
            cout << "boost::regex_merge result: " << my_result << endl;
            // I get a trailing + character: +123+
            // I expected as in earlier liiboost-regex versions: +123
            exit(0);
        } catch(...) {
            cout << "boost::regex_merge exception" << endl;
        }
    } catch(...) {
        cout << "boost::regex()exception" << endl;
    }
    exit(1);
}

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