Example #1
0
void ConsoleTools::RETest(){
  SMatches match;
  CRegExp *re;
  bool res;
  char text[255];

  re = new CRegExp();
  do{
    printf("\nregexp:");
    gets(text);
    if (!re->setRE(&DString(text))) continue;
    printf("exprn:");
    gets(text);
    res = re->parse(&DString(text), &match);
    printf("%s\nmatch:  ",res?"ok":"error");
    for(int i = 0; i < match.cMatch; i++){
      printf("%d:(%d,%d), ",i,match.s[i],match.e[i]);
    }
  }while(text[0]);
  delete re;
}