Welcome! Log In Create A New Profile

Advanced

Re: Matching a href spec with Lua regex

June 27, 2014 12:57PM
As usual, found my error.

The following is properly matcing the regex :

local escUri = function (m)
local _str = "href=\\"http://10.0.9.44/?_redir_="
_str = _str .. ngx.escape_uri(m[1]) .. "\\""
return _str
end

local newStr, n, err = ngx.re.gsub(ngx.arg[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 data.

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

-Vamshi
Subject Author Posted

Matching a href spec with Lua regex

vamshi June 27, 2014 10:28AM

Re: Matching a href spec with Lua regex

vamshi June 27, 2014 12:57PM

Re: Matching a href spec with Lua regex

vamshi June 27, 2014 01:03PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 289
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready