Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-10-31 05:58:34


Brian Krahmer wrote:
> Hello,
> I'm a new member to the mailing list. BTW, thanks to everyone who
> contributes to boost. It's a fantastic software. I am having a
> problem with building an expression object. The line in question
> reads 'boost::regex expression(pattern, options);', where I'm using
> the boost::regex::extended option, and the pattern looks like this:
> "^([0-7]\\..*|8\\.0(\\.[0-3](\\.[0-3])?)?)[^.0-9]*?$". I fired up a
> ruby interpreter, and it handled the regex fine (using "8.0.0.1
> (en-US)" as a positive, and "9.0.0.1 (en-US)" as a negative). Can
> anybody tell me what is wrong with this regex, or confirm that there
> may be a bug in the library?

Nope there's a bug in the options you are using - boost::regex::extended
enables the "POSIX extended" flavour of regular expressions - and these
don't support non-greedy repeats. Use boost::regex::perl if you want to use
these (since you are using Perl-style regexes).

HTH, John.


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