#include <regex.h>
#include <sys/types.h>

#define True  1
#define False !True

int match (char *string, char *pattern, regmatch_t *pmatch)
{
  int           status;
  regex_t       re;

  status = regcomp (&re, pattern, REG_EXTENDED);
  if (status)
    {
      regfree (&re);
      return False;
    }
  status = regexec (&re, string, (size_t) 1, pmatch, 0);
  regfree (&re);
  if (status)
    return False;
  return True;
}