当前位置: 代码迷 >> 综合 >> c++11 wstring和string简单正则表达式使用
  详细解决方案

c++11 wstring和string简单正则表达式使用

热度:21   发布时间:2024-01-24 05:27:14.0

std::regex e("^([^ ]*)3DSMAX(\\d{4})_MAIN([^ ]*)");
//std::regex e("([^ ]*)3DSMAX(\\d{4})_MAIN");

    std::smatch sub_match;

    //从第一行中解析请求方法、路径和 HTTP 版本
std::string line = "VRAY30_RT_FOR_3DSMAX2016_MAIN";
if (std::regex_match(line, sub_match, e)) {
int i = 100;
}

    std::wregex re(L"^([^ ]*)3DSMAX(\\d{4})_MAIN([^ ]*)");
std::wsmatch w_sub_match;

    std::wstring w_line = L"VRAY30_RT_FOR_3DSMAX2016_MAIN";
if (std::regex_match(w_line, w_sub_match, re)) {
int i = 100;
}

  相关解决方案