Boost logo

Boost Users :

Subject: Re: [Boost-users] [regex] perl compatibility
From: Eric Niebler (eric_at_[hidden])
Date: 2010-10-30 20:00:43


On 10/30/2010 4:54 PM, Christian Henning wrote:
> 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;
> }

You should read the docs. regex_match only returns true if the regex
matches *all* of the input. Use regex_search.

And read the docs. :-)

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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