tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bug in TRE regular expression library



On 20.07.2010 20:39, Christos Zoulas wrote:

> Which example?

Sorry, I forgot it. It is now added below.

Ralf

-----------------------

#define p "(.)\\1$"

int _tmain(int argc, _TCHAR* argv[])
{
  regex_t RE;

  int nMatches, rc;

  regmatch_t *matches;

  TRE_MB_CUR_MAX = 2;

  rc = tre_regncomp(&RE, p, strlen(p), REG_EXTENDED);
  printf ("%d\n", rc);

  nMatches = RE.re_nsub + 1;
  matches =  malloc (nMatches * sizeof(matches[0]));

  rc = tre_regexec(&RE, "foox", nMatches, matches, 0);
  printf("Result: %d\n", rc);

  free(matches);

  tre_regfree(&RE);

  printf ("\nDone");
  scanf ("*%s");

  return 0;
}


Home | Main Index | Thread Index | Old Index