gpt4 book ai didi

c++ - 从 sregex (Boost Xpressive) 中获取原始正则表达式

转载 作者:太空宇宙 更新时间:2023-11-04 14:28:04 24 4
gpt4 key购买 nike

我有以下代码。

sregex rex = sregex::compile( "(\\w+) (\\w+)!" );

如何得到“(\w+) (\w+)!”从雷克斯出来?

最佳答案

查看 documentation for basic_regex<> (sregex 只是 basic_regex 的 typedef),我没有看到任何看起来可以检索正则表达式的原始文本表示的函数。

如果你真的需要它,你将不得不创建你自己的类,它同时包含一个 sregex 和一个 std::string。

关于c++ - 从 sregex (Boost Xpressive) 中获取原始正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2106657/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com