Comments (3)
I can't image the "regex is matched in a "greedy" way" or ONIG_OPTION_GREEDY.
Is it different from a regex which does not include any non-greedy operators.
from oniguruma.
For example, in the string "2 km 1 km/h 5 km/h"
onig_search
with regex "[0-9]+[[:space:]](km|km/h)"
with ONIG_OPTION_NONE
finds three matches: "2 km", "1 km"
and "5 km"
, but with ONIG_OPTION_FIND_LONGEST
the matches become greedy: "1 km/h"
and "5 km/h"
.
It both makes group matches greedy, and only keeps the longest matches. This isn't logical that greediness of the group operator also changes, because some people might need to only get the longest matches, and some people might only need the greedy group operator, and this option does both at the same time.
from oniguruma.
It is too difficult to select the longest element in alternatives at runtime.
And as you know, alternative operator has priorities from the left to the right.
I think that'll be enough for many cases.
from oniguruma.
Related Issues (20)
- Internal `^` and `$` don't match as characters for GREP and POSIX_BASIC syntax HOT 4
- add oniguruma-devel to centos8.0+ HOT 2
- Dynamic library generated failed to support "(?-i)" HOT 3
- oniguruma not able to installed on PPC64le architecture HOT 3
- `.{0,99}` and `.*` behave differently on short input HOT 2
- mbc_enc_len(const UChar* p) to be improved HOT 4
- Does Oniguruma support POSIX collating symbols or equivalence classes? HOT 1
- New version?🤔 HOT 1
- Does "retry-limit-in-match over" mean NOT MATCH? HOT 23
- ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS not working for ^* pattern HOT 1
- Literal escaped braces HOT 2
- what is escape code for `.` (literal dot)? HOT 1
- onig_match() can return wrong results with lookbehind at the end of the string HOT 2
- ONIG_SYNTAX_EMACS doesn't support "shy groups"
- With ONIG_SYNTAX_DEFAULT pattern '(?s)ABC' fails with 'undefined group option'. HOT 12
- Error 'unmatched range specifier in char-class' with hyphen in character class. HOT 1
- typos HOT 1
- :alpha: character class matches "non-letter" unicode characters. HOT 4
- Sample pattern and content to trigger error in onig_search? HOT 2
- Invalid utf8 sequence matches the pattern while it probably should not. HOT 1
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 oniguruma.