rules: accept rule if regexp is ok or value is equal
correct problem matching expression with - or special regexp character Signed-off-by: Cedric GESTES <ctaf42@gmail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
db10f783a6
commit
cbaefeed9d
|
@ -52,8 +52,10 @@ rules = {}
|
||||||
function match(c, rule)
|
function match(c, rule)
|
||||||
for field, value in pairs(rule) do
|
for field, value in pairs(rule) do
|
||||||
if c[field] then
|
if c[field] then
|
||||||
if type(c[field]) == "string" and not c[field]:match(value) then
|
if type(c[field]) == "string" then
|
||||||
|
if not c[field]:match(value) and c[field] ~= value then
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
elseif c[field] ~= value then
|
elseif c[field] ~= value then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue