Commit 3558777c authored by François Perrad's avatar François Perrad
Browse files

handles `fnmatch` from LuaPosix when available

parent 4822c17d
Pipeline #152626 passed with stages
in 23 seconds
Revision history for lua-Silva
- handles fnmatch from LuaPosix when available
0.1.3 Sun Jun 16 14:30:00 2019
- fix last empty path-style parameter : ';x=1;y=2;empty'
......@@ -103,6 +103,7 @@ bed:
hererocks bed $(BED_OPTS) --no-readline --luarocks latest --verbose
bed/bin/luarocks install lua-testmore
bed/bin/luarocks install lrexlib-pcre
bed/bin/luarocks install luaposix
bed/bin/luarocks install luacov
hererocks bed --show
bed/bin/luarocks list
......@@ -14,7 +14,7 @@ its default value is `'template'`, the following values are handled :
- `'identity'` wraps the Lua string equality (`==`)
- `'lua'` wraps the Lua regex (`string.match`)
- `'pcre'` wraps the PCRE regex from [lrexlib-pcre](
- `'shell'` wraps the POSIX `fnmatch()` function (available via FFI or implemented in plain Lua)
- `'shell'` wraps the POSIX `fnmatch()` function (available via FFI or [LuaPosix]( or implemented in plain Lua)
- `'template'` wraps an URI Template ([RFC 6570]( - level 3) regex engine
Each kind of pattern is implemented as a plugin, so this list is easily extensible.
......@@ -23,6 +23,18 @@ if r then
if not match then
local posix
r, posix = pcall(require, 'posix.fnmatch')
if r then
local fnmatch = posix.fnmatch
match = function (s, patt)
if 0 == fnmatch(patt, s, -1) then
return s
if not match then
match = function (s, patt, i, j)
i = i or 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment