gpt4 book ai didi

来自 Visual Studio 2013 兼容性的 C++ Regex

转载 作者:行者123 更新时间:2023-11-28 06:11:45 25 4
gpt4 key购买 nike

这是我在 C++11 和 VS 2013 rc5 中使用正则表达式从解析 GLSL 着色器文件中提取文本的漫长旅程的后续行动。

这是预期的结果:

Real time work editor here!

C++ 等价物看起来像这样,它是 PHP 版本的山寨版:

std::smatch u;
std::string s = l_shader->GetData();
std::smatch u;
std::regex_search(s.cbegin(), s.cend(), u, std::regex("<(\\S+)[!]>([.*\\s*\\S*]*?)<[!]\\S+>"));

不幸的是,std::regex_search 不返回任何结果。我一直在努力想弄明白。我错过了什么?

最佳答案

在我看来这像是一个错误。我可以确认,对于 VC++2013,没有任何匹配项——但对于 VC++2015,每个着色器都匹配,正如(我认为)您所期望的那样。

关于来自 Visual Studio 2013 兼容性的 C++ Regex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31127447/

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