Matching a href spec with Lua regex

vamshi nginx-forum at
Fri Jun 27 16:57:09 UTC 2014

As usual, found my error. 

The following is properly matcing the regex :

                local escUri = function (m)
                    local _str = "href=\\""
                    _str = _str .. ngx.escape_uri(m[1]) .. "\\""
                    return _str

                local newStr, n, err =[1],
"href=\\"(.*)\\"", escUri, "ijox")
                print(ngx.arg[1]) --> still original text 

>From my debug logs, I can see that the regex susbstitution is happening
properly. But the href still remains the same. Probably because of chunked

I will try to aggregate the response body and then do the substitution. But
if someone sees anything wrong, your help would be appreciated. 


Posted at Nginx Forum:,251234,251243#msg-251243

More information about the nginx mailing list