#include <stdlib.h>
#include <string>
#include <iostream>
#include <pme.h>
int main()
{
std::string txt="42 43";
std::string re1="(42)";
std::string re2="( )";
std::string re3="(\\d+)";
PME re(re1+re2+re3,"gims");
int n;
if ((n=re.match(txt))>0)
{
std::string int1=re[1].c_str();
std::string ws1=re[2].c_str();
std::string int2=re[3].c_str();
std::cout << "("<<int1<<")"<<"("<<ws1<<")"<<"("<<int2<<")"<< std::endl;
}
}
|