I am trying to replace a regex. The specific problem that I cannot understand is that, following my 2nd inverse representation, I have a string literal (number one). Using MS Visual Studio 2012 (C ++ console project ... not .NET), it does not work. I guess because it takes my backreference as $ 21, instead of $ 2. I tried a different syntax but can't come up with something that works!
std::string input = "my_variable_name_iei_lo1";
std::string regx = "(\\w+)iei_(lo_hi)1";
std::string sub = "$1ied_$21";
std::regex rx(regx);
std::string result = std::regex_replace(input, rx, sub);
I tried various methods of setting a backlink:
std::string sub = "$1ied_${2}1";
// result is "my_variable_name_ied_${2}1"
// should be "my_variable_name_ied_lo1"
Other things give me syntax errors, including trying to use named capture groups, but then read that this is no longer supported. So close to my answer, but still so far away!