You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior of ONIG_OPTION_FIND_LONGEST causes two effects:
regex is matched in a "greedy" way (the longest possible match is found at every location)
shorter matches are skipped by onig_match, so that it returns only the longest matches (multiples are allowed)
I need it to not skip anything, but match in a greedy fashion. Is this currently possible?
If this is not possible, I would like to suggest to split ONIG_OPTION_FIND_LONGEST into two new options: ONIG_OPTION_GREEDY and ONIG_OPTION_ONLY_LONGEST. It's best to be able to specify different bits of behavior separately.
The text was updated successfully, but these errors were encountered:
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.
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.
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.
Current behavior of ONIG_OPTION_FIND_LONGEST causes two effects:
I need it to not skip anything, but match in a greedy fashion. Is this currently possible?
If this is not possible, I would like to suggest to split ONIG_OPTION_FIND_LONGEST into two new options: ONIG_OPTION_GREEDY and ONIG_OPTION_ONLY_LONGEST. It's best to be able to specify different bits of behavior separately.
The text was updated successfully, but these errors were encountered: