Hello!
On Sat, Aug 30, 2014 at 2:10 PM, Gordon Madarm wrote:
> I want to replace the entire string with the string "test", but am having
> difficulty due to the question mark symbol in the string. I tried escaping
> the ? with a % as well as a \ and $ without success, e.g.:
>
> body_filter_by_lua 'ngx.arg[1] =
> ngx.re.gsub(ngx.arg[1],"listproducts.php%?cat=%d", "test") ';
>
See
https://github.com/openresty/lua-nginx-module#special-pcre-sequences
In short, you need to escape once for the nginx string literal and
another time for Lua literal string. Better use
body_filter_by_lua_file instead of avoid double-escaping.
Regards,
-agentzh