How should I get the part that's matched by a regex location in OpenResty / Nginx Lua module?
For example, I want to use $1 in Lua in the following case:
location ~ ^/example/([0-9]+)/ {
content_by_lua_block {
-- What to use for \1 ?
ngx.say("Code: " .. (ngx.var.1 + 1))
}
}
The expected behavior would be getting Code: 1235 when visiting /example/1234/.