如何使用xpath同时匹配两个元素?

#include <regex>
#include <iostream>
#include <string>

std::vector<std::string> fetchMatches(std::string str,const std::regex re) {
    std::vector<std::string> matches;
    std::smatch sm; // Use to get the matches as string

    while (regex_search(str,sm,re)) {
        matches.push_back(sm.str());
        str = sm.suffix();
    }

    return matches;
}

int main() {
    std::string example_input = "(P1,3): (E10,E20,E1,E3)";

    std::regex re{"\\d+"};

    auto matches = fetchMatches(example_input,re);

    for (const auto& match : matches) {
        std::cout << match << std::endl;
    }

    return 0;
}

我想提取上面的元素,其中仅包含两个跨度,一个跨度为文本“下载”,另一个跨度为文本“ book”。两者之间应该有一些空格。

有人可以告诉我这样做的正确方法是什么?谢谢。

NYBLOVE 回答:如何使用xpath同时匹配两个元素?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3169816.html

大家都在问