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
Backwards search not respecting range #22
Comments
It seems to be caused by this #ifdef block: Line 4176 in 754f936
I don't know why this block is needed. I'll look into it more closely. BTW, I think the expected result is |
Hmm, the #ifdef block was added with Oniguruma 5.7.0. Copied from the HISTORY:
Note: |
Thanks for looking into this. Does this mean that defining I tried to define it in |
Yes, I think so. But currently the result is After applying the following patch, the result becomes --- a/regexec.c
+++ b/regexec.c
@@ -4173,11 +4173,6 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
}
}
else { /* backward search */
-#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
- if (orig_start < end)
- orig_start += enclen(reg->enc, orig_start); /* is upper range */
-#endif
-
if (reg->optimize != ONIG_OPTIMIZE_NONE) {
UChar *low, *high, *adjrange, *sch_start;
I'm concerning about side effects caused by this patch. More tests are needed. |
No.67 should not match after the fix of Issue #22.
Summary
If I call
onig_search
with a start/range of3-0
then it may still return a match outside this range.Steps to Reproduce
Build the following source:
Expected Result
I would expect the output to be
0-3
.Actual Result
The program outputs
3-4
.Notes
This was tested with current master (9cd4fa1) but problem has existed for as long as I know.
The text was updated successfully, but these errors were encountered: