Boost logo

Boost Users :

From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-09-03 09:50:28


Silvio Reis Junior wrote:

> Hello folks!
> I'm trying to work with boost::regex but I'm stuck.
> I wrote the following code:
>
> //-------------------------------------------------------------------
> int main( int argc, CHAR* argv[] )
> {
> boost::regex RegEx( "(eth\\d)" );
> if ( boost::regex_match( "dsjkadhjksadjks eth1: ssgdsdhjasgdjg", RegEx )
> )
> {
> printf( "Found.\n" );
> }
> return 0;
> }
>
> I tested the expression with Expresso and it's correct although it doesn't
> work in the code above.
> Is there something missing?

The docs for regex_match say:

   The algorithm regex_match determines whether a given regular expression matches all of a given
   character sequence denoted by a pair of bidirectional-iterators, the algorithm is defined as
   follows, the main use of this function is data input validation.

The regexp in our example does not match all of the input, it seems to me.

- Volodya


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