Skip to content

Commit 4b9100c

Browse files
committed
bugfix: pattern matching an empty substring in ngx.re.gmatch did not match at the end of the subject string.
1 parent ad5e7f7 commit 4b9100c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/ngx_http_lua_regex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ ngx_http_lua_ngx_re_gmatch_iterator(lua_State *L)
948948
offset++;
949949
}
950950

951-
if (offset >= (ssize_t) subj.len) {
951+
if (offset > (ssize_t) subj.len) {
952952
offset = -1;
953953

954954
if (!(ctx->flags & NGX_LUA_RE_COMPILE_ONCE)) {

t/035-gmatch.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,4 +509,5 @@ matched: []
509509
matched: []
510510
matched: []
511511
matched: []
512+
matched: []
512513

0 commit comments

Comments
 (0)