Boost logo

Boost Users :

Subject: [Boost-users] [regex] perl compatibility
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-10-30 19:54:51


Hi there, I was under the expression that a regular expression which
works with perl would also work with boost::regex. The following very
simple test program doesn't work:

    if( boost::regex_match( "query", boost::regex( "q[u]" )))
    {
        cout << "match" << endl;
    }
    else
    {
        cout << "no match" << endl;
    }

whereas the perl equivalent works just fine:

$text = "query";

if($text =~ m/q[u]/)
{
    print "match!\n";
}
else
{
    print "no match\n";
}

Meaning the perl code matches the regex inside $text and the
boost::regex doesn't match.

Can someone tell me what's wrong here with my thinking? And yes, I'm
very new to regex overall. ;-)

Thanks,
Christian


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