BOOST Regex Frage



  • Hallo zusammen,

    ich habe mal eine Frage bzgl. Boot und dem darin enthaltenen REGEX.
    Installation und Funktionalität ist soweit ok. Das passt auch ganz gut.

    std::string ss = "^(?<const>a|b)\\g{const})$";
    static const boost::regex e(ss);
    std::cout << "Expression:  \"" << e << "\"\n";
    std::cout << "Text:        \"" << s << "\"\n";
    const bool x = boost::regex_match(s, e, boost::match_default | boost::format_all | boost::match_extra);
    

    Nun möchte ich jedoch einige Expressions per Namen aufrufen.
    DAzu verwende ich

    (?<const>a|b)
    

    zur Definition
    und

    \\g{const}
    

    um diese aufzurufen.

    Leider wird aber das Wort "a" und das Wort "b" als FALSCH von reges_match zurückgegeben.
    Weiß jemand was ich falsch mache?

    Danke & Gruß


Anmelden zum Antworten