lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi list,

After some questions were asked on the IRC channel, I realized that
contrary to string.match, string.gsub does not throw an error when
passed a pattern containing an unfinished capture, ie. an unescaped
opening parenthesis without the corresponding closing parenthesis. The
behavior when passing such a pattern is actually quite weird. For
example calling string.gsub("aaa", "(", "b") returns "bababab", 4.

For consistency purpose I believe this should be considered an error
in string.gsub too. This should be changed in the upcoming 5.1.5, or
if the behavior change is a problem it ought to make its way into 5.2.

Doub.