#include <stdlib.h>
#include <string>
#include <iostream>
#include <pme.h>
int main()
{
std::string txt="11:Jan:2019 \"This is an Example!\"";
std::string re1=".*?";
std::string re2="\\d";
std::string re3=".*?";
std::string re4="\\d";
std::string re5=".*?";
std::string re6="(\\d)";
std::string re7=".*?";
std::string re8="(an)";
PME re(re1+re2+re3+re4+re5+re6+re7+re8,"gims");
int n;
if ((n=re.match(txt))>0)
{
std::string d1=re[1].c_str();
std::string word1=re[2].c_str();
std::cout << "("<<d1<<")"<<"("<<word1<<")"<< std::endl;
}
}
|