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
The ability to use | for regex-style alternation within groups would be nice. Probably can use a modified version of match_balance to find the end of the group, then match until encountering | or ). On success, make a recursive call to match beginning at the end of the group. If that returns success, pass it up the chain, else on NULL backtrack to the start of the group in the source string and attempt matching in the next alternative.
The major problem will be correctly counting capture groups, including capture groups passed over in unused alternatives. Also, need to handle groups that don't participate in the match (return nils in match table, but how to handle gsub() and :expand()?).
The text was updated successfully, but these errors were encountered:
Also, I'm guaranteeing that all patterns written for stock Lua will remain compatible with the basic functions in this library as long as they do not rely on undefined behavior, and the 5.3 manual specifies that non-magic characters match themselves literally whether escaped or not, so new punctuation characters cannot be used even with an escape.
Thus, this would be limited to enhanced patterns only.
The ability to use
|
for regex-style alternation within groups would be nice. Probably can use a modified version ofmatch_balance
to find the end of the group, then match until encountering|
or)
. On success, make a recursive call tomatch
beginning at the end of the group. If that returns success, pass it up the chain, else onNULL
backtrack to the start of the group in the source string and attempt matching in the next alternative.The major problem will be correctly counting capture groups, including capture groups passed over in unused alternatives. Also, need to handle groups that don't participate in the match (return
nil
s in match table, but how to handlegsub()
and:expand()
?).The text was updated successfully, but these errors were encountered: