开发者

Getting Original Regular Expression Out From sregex (Boost Xpressive)

开发者 https://www.devze.com 2022-12-17 20:35 出处:网络
I have the following code. srege开发者_开发百科x rex = sregex::compile( \"(\\\\w+) (\\\\w+)!\" );

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号