kokke / tiny-regex-c

Small portable regex in C
The Unlicense
1.24k stars 174 forks source link

Cannot match end-of-pattern match #84

Open perazz opened 1 year ago

perazz commented 1 year ago

Hi and thanks for an amazing library - I'm developing a Fortran port of it here.

I've just found an issue/potential bug with the end-pattern command.

text = "table football" pattern = "l$"

returns index=13, matchlength=3

Here's the sample test program:

#include <stdio.h>
#include <stdlib.h>
#include "re.h"
int main() {

   const char *text = "table football";
   const char *pattern = "l$";
   int index,len;

   index = re_match(pattern, text, &len);

   printf("index=%d len=%d \n",index,len);
}

Tested on Mac with clang 13.1.6