jeudi 19 septembre 2019

Can regex_search in C++ match multiple strings?

While Learning regular expression with c++. How to find all the words that match the regex.

regex b("i.t");
smatch m;

oTest.m_strSentence = "int ist";
regex_search(oTest.m_strSentence, m, b);

for (auto x : m) 
    cout << x << " "; 

was expcting output to be

int ist

But got

int

Aucun commentaire:

Enregistrer un commentaire