Comments (4)
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 2-3
.
from onigmo.
Hmm, the #ifdef block was added with Oniguruma 5.7.0.
Copied from the HISTORY:
2007/04/27: Version 5.7.0
2007/04/20: [spec] add config USE_MATCH_RANGE_IS_COMPLETE_RANGE.
2007/04/20: [impl] refactoring in match_at().
Note: USE_MATCH_RANGE_IS_COMPLETE_RANGE
was changed to USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
with Oniguruma 5.9.0.
from onigmo.
Thanks for looking into this.
Does this mean that defining USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
should return a match of 2-3
?
I tried to define it in regexec.c:33
but got unchanged result.
from onigmo.
Does this mean that defining
USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
should return a match of2-3
?
Yes, I think so. But currently the result is 3-4
as you reported.
After applying the following patch, the result becomes 2-3
when USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
is defined.
(If it is not defined, the result becomes 3-6
.)
--- 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.
from onigmo.
Related Issues (20)
- invalid pattern compilation /(^*0m\d{2}\:\d{2}\:\d{2})/ HOT 1
- 'st_check_for_sizeof_st_index_t' declared as array with a negative size HOT 15
- Python packaging
- Memory corruption in onig_error_code_to_str() HOT 1
- Out-of-bounds read in parse_char_class() HOT 1
- ſ(U+017F) and K(U+212A) should not be case-insensitive equivalent to S and K HOT 5
- error: Linking globals named 'regerror' with Emscripten
- Memory leaks reported by Scan Coverity
- Stack-buffer-overflow in renumber_by_map in regcomp.c HOT 1
- Name2CType data wrong for many Indic scripts? HOT 2
- `[\p{Emoji}]` also matches numerical characters HOT 1
- Absence operator is broken HOT 2
- Add API to mitigate exponential backtracking (ReDoS) HOT 3
- Use of \K when the string to match after \K can be empty
- Support Unicode script extensions
- Captured strings of (.)(\g<1>) are same HOT 4
- An error occurred while using case-insensitive option (?i) . HOT 5
- A deficient regex pattern causes app to freeze .
- Separating or excluding the regcomp/regexec/regerror functions from the library.
- Windows | fatal error C1083: Cannot open include file: 'alloca.h': No such file or directory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onigmo.