[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Possible bug in string.gsub
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Fri, 18 Mar 2011 17:47:29 +0100
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.