-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
matchlen may be wrong #53
Comments
Is anyone also facing this problem? |
Yes, I did. I had the same result as you. pattern = ".*a.+a" |
Quick note: tried #63 , but no luck |
no luck by applying #61 |
Hi, I'm not sure if this is the same issue, but I'm matching "\n\n+" in a simple text file (looking for multiple-newline separated paragraphs, and I noticed that matchlen was actually counting every \n that it came across rather than just the number of them actually matching the pattern. The fix is simple ... in re_matchp() matchlen is not zero'd when you get a matchpattern() failure. I simply added a "*matchlength = 0" as the last line in the do/while loop and it seems to be working perfectly ... I will do some more testing. Regards, Lee. |
int match_len;
char* s = "aa";
char* p = ".*a.*a";
int match_idx = re_match(p, s, &match_len);
expected: match_len == 2
result: match_len == 3
The text was updated successfully, but these errors were encountered: