Re: Bug in TRE regular expression library

Ralf Junker <[email protected]> Tue, 20 Jul 2010 21:44:13 +0200
Newsgroups gmane.os.netbsd.devel.general
Message-ID <[email protected]>
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;
}