
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.