Boost logo

Boost :

From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2004-01-09 18:33:56


[John Maddock]
> Yikes! OK I've confirmed that with gcc (works OK with
> VC7.1).
> Patches going into cvs now.

Yay! It looks like your patches have solved both of the problems I noticed.

Have you added a regression test so that this does not reoccur?

With Boost CVS 20040109 I now see:

C:\Temp\foozle>type test.cc
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

int main() {
    cout << regex_match("a", regex(".*")) << endl;
    cout << regex_match("a", regex(".*?")) << endl;
}

C:\Temp\foozle>g++ -Wall -W test.cc -o test.exe -lboost_regex

C:\Temp\foozle>test
1
1

C:\Temp\foozle>type othertest.cc
#include <iostream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;

string strip(const string& s) {
    return regex_merge(s, regex("\\A\\s*(.*?)\\s*\\z"), "$1",
format_no_copy);
}

void test(const string& s) {
    cout << "\"" << s << "\" => \"" << strip(s) << "\"" << endl;
}

int main() {
    test("x");
    test(" x");
    test("x ");
    test(" x ");
}

C:\Temp\foozle>g++ -Wall -W othertest.cc -o othertest.exe -lboost_regex

C:\Temp\foozle>othertest
"x" => "x"
" x" => "x"
"x " => "x"
" x " => "x"

C:\Temp\foozle>

This is what I expected.

Stephan T. Lavavej
http://nuwen.net


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk