diff options
-rw-r--r-- | src/lua/lua_regexp.c | 3 | ||||
-rw-r--r-- | test/lua/unit/regxep.lua | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c index 2f7ea3ea1..75e54bab5 100644 --- a/src/lua/lua_regexp.c +++ b/src/lua/lua_regexp.c @@ -568,6 +568,9 @@ lua_regexp_split (lua_State *L) lua_rawseti (L, -2, ++i); matched = TRUE; } + else if (start == end) { + break; + } old_start = end; } diff --git a/test/lua/unit/regxep.lua b/test/lua/unit/regxep.lua index d0b1c422f..0bb4db935 100644 --- a/test/lua/unit/regxep.lua +++ b/test/lua/unit/regxep.lua @@ -68,6 +68,9 @@ context("Regexp unit tests", function() {'\\s', ' one two ', {'one', 'two'}}, -- multiple delimiters {'\\s', ' one ', {'one'}}, -- multiple delimiters {'[:,]', ',,,:::one,two,,', {'one', 'two'}}, -- multiple delimiters + {'[\\|\\s]', '16265 | 1.1.1.0/22 | TR | ripencc | 2014-02-28', + {'16265', '1.1.1.0/22', 'TR', 'ripencc', '2014-02-28'}}, -- practical + {'|', '16265 | 1.1.1.0/22 | TR | ripencc | 2014-02-28', {}} -- bad re } for _,c in ipairs(cases) do |