From b6100816193cddd66e71f43410d3705b5cc2adf4 Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Fri, 12 Apr 2013 07:29:56 +0000 Subject: [PATCH] Added optional parameter flags to lua_ap_regex(). This enables to call r:regex() with a flag to do case-insensitive matches. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1467188 13f79535-47bb-0310-9956-ffa450edef68 --- modules/lua/lua_request.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c index bf7220e499..1a498bb446 100644 --- a/modules/lua/lua_request.c +++ b/modules/lua/lua_request.c @@ -889,14 +889,15 @@ static int lua_ap_expr(lua_State *L) /* - * lua_ap_regex; r:regex(string, pattern) - Evaluates a regex and returns - * captures if matched + * lua_ap_regex; r:regex(string, pattern [, flags]) + * - Evaluates a regex and returns captures if matched */ static int lua_ap_regex(lua_State *L) { request_rec *r; int i, rv; + flags; const char *pattern, *source; char *err; @@ -909,8 +910,9 @@ static int lua_ap_regex(lua_State *L) r = ap_lua_check_request_rec(L, 1); pattern = lua_tostring(L, 2); source = lua_tostring(L, 3); + flags = luaL_optinteger(L, 4, 0); - rv = ap_regcomp(®ex, pattern, 0); + rv = ap_regcomp(®ex, pattern, flags); if (rv) { lua_pushboolean(L, 0); err = apr_palloc(r->pool, 256); -- 2.40.0