ngx_lua location capture issue

Nginx User nginx at
Thu Oct 20 08:17:21 UTC 2011

On 20 October 2011 03:43, agentzh <agentzh at> wrote:
> On Thu, Oct 20, 2011 at 2:10 AM, Nginx User <nginx at> wrote:
>> I have a set of about 70 regexes that are run using access_by_lua_file
> A rule of thumb is that "\" should become "\\\\" (four back-slashes!)
> while using access_by_lua and "\\" (two back-slashes!) while using
> access_by_lua_file. You're writing things like "\\\s" (three
> back-slashes!), which is weird.
> Why not put your Lua code into an external .lua file and use
> access_by_lua_file or rewrite_by_lua_file instead? That way you only
> need to escape each "\" only once.
I am using an external .lua file and I only get consistent results
when I use "\\\s" etc. "\\s" etc resulted is several ")" expected near
"|" type messages.

Basically, it's what seems to work for me.

More information about the nginx mailing list