Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-09-15 05:14:52


>Using 1.33, I get empty() set to false with the default constructor. In
>addition, if you attempt to search using an empty regex, the program
>segfaults. The following example demonstrates the problem:

Yes, it's a bug that will be fixed in 1.33.1 when it arrives.

>This does not happen if I initialize the regex using an empty string (it
>throws empty expression). Which leads to the main question (and the
>reason why I discovered all of this): is it possible to make a regular
>expression that matches anything? For instance, when using AWK, if you
>define a rule without a pattern, i.e.:

>I thought an empty regex would do the trick.

An empty regex has always been an error in Boost.Regex (because I couldn't
think of a legitimate use for it).

Use (?:) for an empty expression,

You can also use these if you really want an empty alternative:

"|abc" is not a valid expression (usually user error), but
"(?:)|abc" does the same thing, as does:
"(?:abc)??" .

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