#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="((?:(?:[0-2]?\\d{1})|(?:[3][01]{1}))[-:\\/.](?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Sept|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)[-:\\/.](?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d])";
std::string re2=".*?";
std::string re3="(an)";
PME re(re1+re2+re3,"gims");
int n;
if ((n=re.match(txt))>0)
{
std::string ddmmmyyyy1=re[1].c_str();
std::string word1=re[2].c_str();
std::cout << "("<<ddmmmyyyy1<<")"<<"("<<word1<<")"<< std::endl;
}
}
|