lua-users home
lua-l archive

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


Hello,

I found two promblems in string library of Lua5.0.2.

1. "^" at the beginning matches with literal "^" by string.gfind.
For example,
> for v in string.gfind("a^b", "^.") do print(v) end
^b

Attached patch "lua502-gfind.patch" solves this problem.

2. Patterns which can match with empty string may matches twice
at same position.
For example,
> = string.gsub("abc", ".*", "x")
xx      2
> = string.gsub("12ab", "%a*$", "x")
12xx    2

These results should be "x  1" and "12x  1".
Attached patch "lua502-emptymatch.patch" solves this problem.

--
asakawa

Attachment: lua502-gfind.patch
Description: Binary data

Attachment: lua502-emptymatch.patch
Description: Binary data

Attachment: patch-test.log
Description: Binary data