lua-users home
lua-l archive

Re: maybe a regex bugs in luajit2

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


print(string.find(uri,'/([%-%+])/(.-)/(.*)')) work OK.

but i think "print(string.find(uri,'/([\-\+])/(.-)/(.*)'))" should not be wrong.


2011年9月18日 steve donovan <steve.j.donovan@gmail.com>
On Sun, Sep 18, 2011 at 6:07 AM, zhiguo zhao <zhaozg@gmail.com> wrote:
>> print(string.find(uri,'/([\-\+])/(.-)/(.*)'))
> stdin:1: invalid escape sequence near ''/(['

You should use % not \  - Lua string patterns are not regexes although
they are similar.

LuaJIT is more strict than Lua 5.1, so it will catch the illegal escape.

steve d.



AltStyle によって変換されたページ (->オリジナル) /