Hi i'm trying to use std::regex with VS2015 and can't find a way of solving the following problem.I have a simple regex which represents image sequence path:
static std::regex SEQPATTERN(R"((.+?\.)(#+|\$F\d|%0\dd|\d+)(\.\w+$))");
I need to change a frame number in file name, so i do:
std::string path = R"(/path/to/seq/my_file_a.0001.jpeg)";
auto res = std::regex_replace(path, SEQPATTERN, std::string("$1777$3");
// $1 - /path/to/seq/my_file_a.
// $2 - 0001
// $3 - .jpeg
And the result is wrong because $1777 is treated like group number which is wrong of course. I cant find a way of escaping "777". I could write my replace string like this, and it would work:
std::string("$1.777.$3");
But dots are already included in both groups($1 and $3), and i don't want to change regex.
Whats my options here? Is it even possible? Thanks.
Aucun commentaire:
Enregistrer un commentaire