Getting Original Regular Expression Out From sregex (Boost Xpressive)
I have the following code.
srege开发者_开发百科x rex = sregex::compile( "(\\w+) (\\w+)!" );
How I can get "(\w+) (\w+)!" out from rex?
Looking at the documentation for basic_regex<> (sregex is just a typedef for basic_regex), I don't see any function that looks like it can retrieve the original textual representation of the regular expression.
If you really need that, you are going to have to create your own class that holds both a sregex and a std::string.
精彩评论