HI Daniel,
On 13.04.2013 08:47, Daniel Gruno wrote:
I think the reason for limiting it to 10 is legacy stuff, so that's what
I've complied with.
but thats way to less for doing something useful; therefore I've decoupled mod_lua from AP_MAX_REG_MATCH, added an own macro MODLUA_MAX_REG_MATCH, made this overwriteable with CFALGS and bumped the default to 25; hopefully a config hacker adds an option so that this can be specified/modified ...

Docs fixed,
well, the sample regex is still wrong - backslash must be escaped:
- local matches = r:regex("foo bar baz", "foo (\w+) (\S*)")
+ local matches = r:regex("foo bar baz", "foo (\\w+) (\\S*)")


ordering of arguments likewise, and r.banner as well as
r.port are now just values, not functions.
great!

Your fix with commit r1467557 "should it somehow return more matches than we have allocated" was my 1st patch too in order to see if that avoids the crash (and sure it does); but IMO its really bad to silently discard matches and give the user no idea why ... we should here think of a normal user who works on a regex pattern, and then wonders (and bashing head against the wall) why his pattern gets accepted without error, but he still gets less matches than expected; therefore I've changed the code to bail out early after the regcomp call when we know already that the pattern has more matches than allowed, and instead return with an error explaining this. So now you can call r:regex() like:
local matches, err = r:regex("foo bar baz", "foo (\\w+) (\\S*)")
if err then
  r:puts(err)
else
  ...

attached some examples to verify my recent changes.

Gün.

Attachment: tstlua.7z
Description: Binary data

Reply via email to