kokke / kokke/tiny-regex-c

Cannot match end-of-pattern match

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

Hi and thanks for an amazing library - I'm developing a Fortran port of it [here](https://github.com/perazz/fortran-regex).

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:

```c
#include
#include
#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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the re_match entry point declared in re.h and reproduce the sample program using pattern "l$" and text "table football". Trace the end-pattern handling and add or update a regression test so the sample returns the correct match index and length.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.