pcre的compile,exec和free的代码

214 阅读1分钟
工作过程中中,将做工程过程中经常用到的内容片段备份一次,下面的内容是关于pcre的compile,exec和free的内容,应该是对各位朋友有所帮助。

#include <stdio.h>
#include <string.h>
#include <pcre.h>
#define EBUFLEN 128
#define BUFLEN 1024
 
int main()
{
    int  erroffset;
    int  ovector[OVECCOUNT];
    int  rc, i;
    printf("String : %s/n", src);
    printf("Pattern: /"%s/"/n", pattern);
        printf("PCRE compilation failed at offset %d: %s/n", erroffset, error);
        return 1;
    }
        if (rc == PCRE_ERROR_NOMATCH) printf("Sorry, no match .../n");
        else printf("Matching error %d/n", rc);
        pcre_free(re);
        return 1;
    }
    }
    return 0;
}