(as an aside maybe we could catch bad ones better by replacing regex strings with overloaded operators the way streams have superceded printf)
Apologies for being slightly off topic for the users group. Has there been any work in this direction? We want to compile the expression for efficiency reasons. Building them up using operator<< might sacrifice this without an additional "reduction" phase to compile down to the most efficient automata. I guess this would be the regexp equivalent to endl. Still I like the idea as a debugging tool and I don't think the efficiency lost would be prohibitive. Regular expressions being more like trees rather than streams the << syntax might get a bit ugly with all the brackets required. E.g.
I think that's not all that easy - as you say dealing with nested sub-expressions and the like is pretty nasty.
How about the equivalent using some hidden template metaprogramming (for use when the expression is fixed at compile time) I have a feeling that the complexity added relative to the minor inconvenience of setting up the expression on start-up outweigh the benefits.
Have you looked at spirirt? OK it's a parser not a regex engine but there is some overlap. John