Re: LuaJIT throws the exception "invalid escape sequence near [^%w' that Lua5.1 does not

  • From: JS <js@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 22 May 2017 15:52:33 +0300

On 22.05.2017 15:45, Crew wrote:

Hi folks,

I am trying to convert to using LuaJIT from Lua5.1 and hit this error in
one of the Lua modules.

As I stated in the subject above LuaJIT is throwing an invalid escape
sequence exception on a sequence that Lua5.1 accepts.

The string that causes the problem is '[^%w\-_ ]'.

Is this a known problem? Is there a workaround apart from deleting the
backslash?


Hi, it should be %-, not \-. Backslash should only be used for characters like \t.

Other related posts: