#include <stdio.h>
#include <string.h>
#include <pcre.h>
int main(int argc, char **argv)
{
const char *error;
int erroffset;
int ovector[186];
char re[8192]="";
char txt[]="11:Jan:2019 \"This is an Example!\"";
char re1[]=".*?";
strcat(re,re1);
char re2[]="(?:(?:[0-2]?\\d{1})|(?:[3][01]{1}))(?![\\d])";
strcat(re,re2);
char re3[]=".*?";
strcat(re,re3);
char re4[]="(?:(?:[0-2]?\\d{1})|(?:[3][01]{1}))(?![\\d])";
strcat(re,re4);
char re5[]="((?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])";
strcat(re,re5);
char re6[]=".*?";
strcat(re,re6);
char re7[]="(an)";
strcat(re,re7);
pcre *r = pcre_compile(re, PCRE_CASELESS|PCRE_DOTALL, &error, &erroffset, NULL);
int rc = pcre_exec(r, NULL, txt, strlen(txt), 0, 0, ovector, 186);
if (rc>0)
{
char day1[1024];
pcre_copy_substring(txt, ovector, rc,1,day1, 1024);
printf("(%s)",day1);
char word1[1024];
pcre_copy_substring(txt, ovector, rc,2,word1, 1024);
printf("(%s)",word1);
puts("\n");
}
}
//
|