/* regular expression test program */
#include <stdio.h>
#include "regexp.h"
char *table[]=
{
  "dave","dave1","dave2","chen","chen1","beaf","meimei"
};
#define tableSize 7

main (int argc, char **argv)
{
  int i = 0;
  char exp[80];
  regexp *rexp = 0;

  while (1) {
    printf ("Enter a regular expression\n");
    scanf ("%s",exp);
    rexp = regcomp (exp);
    if (rexp == 0) {
      fprintf (stderr, "regular expression generated failed\n");
      exit (1);
    }
    for (i = 0; i < tableSize; i++) {
      if (regexec (rexp, table[i]) != 0)
        printf ("Matche: %s\n",table[i]);
    }
    free (rexp);
  }
} 
