I'm developing a C ++ system that needs to get some information from a String using regular expression, I'm using a regular expression that I've used in PHP perfectly, but in C ++ it returns blank.
const std::string s = "{{ teste }}";
std::string r = "{{((.)+)}}";
std::regex rgx(r);
std::smatch match;
if (std::regex_search(s.begin(), s.end(), match, rgx)){
std::cout << "Number of maths: " << match.size() << "\n";
for(int i=0; i < match.size(); i++){
std::cout << "match: '" << match[i] << "'\n";
}
}
In PHP it looked like this and it worked perfectly:
$print_value = '/{{((.)+)}}/';
$var_get = "{{ teste }}";
preg_match($print_value, $var_get, $matches, PREG_OFFSET_CAPTURE);
$piece = explode($formatches[0][0], $var_get);
.
.
.
What is going wrong? Other expressions I use work perfectly.
Thank you in advance.