// URL that generated this code:
// http://txt2re.com/index-c++.php3?s=11:Jan:2019%20%22This%20is%20an%20Example!%22&-51&-9999
#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="()"; // 1
std::string re2=".*?"; // Non-greedy match on filler
std::string re3="(!)"; // Any Single Character 1
PME re(re1+re2+re3,"gims");
int n;
if ((n=re.match(txt))>0)
{
std::string 1=re[1].c_str();
std::string c1=re[2].c_str();
std::cout << "("<<1<<")"<<"("<<c1<<")"<< std::endl;
}
}
//-----
// C++ does not provide a regular expression feature as standard.
//
// To run this code you will need to first download and install
// the PCRE library from http://www.pcre.org/ and
// the PME library from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib/
//
// Note that on Linux systems PCRE is often already installed in /usr/lib/libpcre* or /usr/local/lib/libpcre*.
//
// Compile and run on Unix using
// # c++ x.cpp -lpme -lpcre
// # ./a.out
//