vendredi 28 août 2015

Getting std::regex_search to work [duplicate]

This question already has an answer here:

I can't seem to get std::regex_search to work. The simple code below won't return true no matter what string I input.

std::regex reg1("password");
std::string temp;
while (getline(std::cin, temp))
{
    if (std::regex_search(temp, reg1))
        std::cout<<"Match!"<<std::endl;
}

std::regex_match will return true if I input "password". I have tried using gcc 4.8.4 and clang 3.6. I'm assuming it's some silly issue, but I can't put my finger on it.

Aucun commentaire:

Enregistrer un commentaire