#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <pcreposix.h>
int regex(char *s, char *reg_expr, int nmatch, regmatch_t pmatch[])
{
regex_t reg;
char rbuf[256];
int r;
if((r = regcomp(®, reg_expr, 0))) {
regerror(r, ®, rbuf, 256);
fprintf(stderr, rbuf);
return -1;
}
r = regexec(®, s, nmatch, pmatch, 0);
regfree(®);
return r ? 0 : 1;
}
char *new_string(char *s)
{
char *tmp;
tmp = (char*)malloc(strlen(s) + 1);
strcpy(tmp, s);
return tmp;
}