All pastes #267730 Raw Edit

Mine

public text v1 · immutable
·published 2006-12-05 01:40 UTC
rendered paste body
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <locale.h>
#include <errno.h>


#include <pcre.h>

int main(int argc,char *argv[])
{
     pcre *re;
     char cgets[250];
     const char *error;
     int erroffset;
     int retexec;
     //re = pcre_compile("([011])([\\d]+)([#])",0,&error,&erroffset,NULL);
     re = pcre_compile("^\\d?\\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\d\\d$",0,&error,&erroffset,NULL);
     if( re )
     {
     while(1){
     printf("Enter the details you wish to match:");
     fgets(cgets,250,stdin);
     retexec = pcre_exec(re,NULL,cgets,strlen(cgets),0,PCRE_PARTIAL,NULL,0);
        switch( retexec)
        {
        case PCRE_ERROR_NOMATCH:
            printf("No Matches\n");
            break;
        case PCRE_ERROR_PARTIAL:
            printf("Partial Match\n");
            break;
        case 0:
            printf("Perfect Match\n");
            break;
        default:
            printf("Error Code: %d\n",retexec);
            break;
        }
        }
     }
     } else  {
            printf("Error in Regex Compilation");
     }
}