lundi 29 juin 2015

regex not working as expected in c++11

I m studying regular expressions in c++11 and this regex search is returning false anybody knows what i m doing wrong here. The search works if i use the pattern "<. * >" . I know that .* stands for amy number of characters except newline

#include<regex>
#include<iostream>

using namespace std;

int main()
{
    bool found = regex_match("<html>",regex("h.*l"));// works for "<.*>"
    cout<<(found?"found":"not found");
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire