Thank you very much for maintaining the excellent library.
I found the latest version of Onigmo suffers from the following incorrect behavior when used with a recursive expression.
/\(((?:[^(]|\g<0>)*)\)/ matches "(abc)(abc)" => OK 馃挌
matches[0] == (0, 5) corresponding to "(abc)" => OK 馃挌
matches[1] == (6, 4) corresponding to a string with negative length => NG 馃挃
/\(((?:[^()]|\g<0>)*)\)/ matches "((abc)(abc))" => OK 馃挌
matches[0] == (0, 12) corresponding to "((abc)(abc))" => OK 馃挌
matches[1] == (7, 11) corresponding to "abc)" => NG 馃挃
It seems that matches[].rm_so refers to the last capture while matches[].rm_eo refers to to the top level capture. I believe the users will be happier if both of them refers to the top level capture. When tested in ruby, the former example returns an invalid string for $2 that causes ArgumentError when given to a function as described at ruby/姝h琛ㄧ従.
Thank you very much for maintaining the excellent library.
I found the latest version of Onigmo suffers from the following incorrect behavior when used with a recursive expression.
/\(((?:[^(]|\g<0>)*)\)/matches"(abc)(abc)"=> OK 馃挌matches[0] == (0, 5)corresponding to"(abc)"=> OK 馃挌matches[1] == (6, 4)corresponding to a string with negative length => NG 馃挃/\(((?:[^()]|\g<0>)*)\)/matches"((abc)(abc))"=> OK 馃挌matches[0] == (0, 12)corresponding to"((abc)(abc))"=> OK 馃挌matches[1] == (7, 11)corresponding to"abc)"=> NG 馃挃It seems that
matches[].rm_sorefers to the last capture whilematches[].rm_eorefers to to the top level capture. I believe the users will be happier if both of them refers to the top level capture. When tested in ruby, the former example returns an invalid string for $2 that causes ArgumentError when given to a function as described at ruby/姝h琛ㄧ従.