Hello!
On Tue, Sep 16, 2014 at 7:50 PM, rvsw wrote:
> https://github.com/openresty/lua-nginx-module#special-pcre-sequences, if we
> specify regex as \\\\d+ in replace filter then does the similar sequence
> happen:
> \\\\d+ is stripped down to \\d+ by the Nginx config file parser and this is
> further stripped down to \d+ by the replace_filter/sregex code before
> running?
That section in ngx_lua's documentation does not really apply to other
nginx module directives because we do not have Lua string literals in
non-Lua context.
replace_filter just accepts whatever from the nginx configuration file parser.
You can always use the ngx_echo module to find out how nginx
interprets the backslashes. Consider
location = /t {
echo '\d';
echo '\\d';
echo '\\';
}
Accessing /t yields
$ curl localhost:8080/t
\d
\d
\
So these are exactly what replace_filter sees and uses.
Regards,
-agentzh