regex et match , comment extraire une valeur
Hello,
Je cherche à récupérer la valeur du paramètre t dans cette string (ça devrait me retourner 1 ) :
ECFG=nf=1:l=en:nt=0:fs=1:dt=pc:t=1:gc=partner-pub-6214731071751595%3A9441469394: Expires=Tue, 31 Oct 2017 09:31:03 GMT
avec ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#define COOKIE_ITEM_REGEX ".*t=(\\d+):.*"
std::string Cookie::get_match(const char* find, const std::string str)
{
std::smatch match;
std::regex const reg(find);
if (!std::regex_search(str.begin(), str.end(), match, reg))
{
return std::string();
}
return match[1];
} |
Mais cela ne fonctionne visiblement pas. J'ai du mal avec les expression régulière :/
Merci d'avance pour vos réponses.