Permalink
Browse files

Support case-insenstive regexes

  • Loading branch information...
1 parent 5d08791 commit 277c6d75c996151f9655575dee6f25206dc1de57 @evanmiller evanmiller committed Sep 3, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 src/db_adapters/boss_db_adapter_mnesia.erl
@@ -132,12 +132,16 @@ test_rec(Rec,{Key, 'le', Value}) ->
test_rec(Rec,{Key, 'matches', Value}) ->
{ok, MP} = re:compile(Value),
case re:run(apply(Rec,Key,[]), MP) of
- {match,_} ->
- true;
- match ->
- true;
- _ ->
- false
+ {match,_} -> true;
+ match -> true;
+ _ -> false
+ end;
+test_rec(Rec,{Key, 'matches', "*"++Value}) ->
+ {ok, MP} = re:compile(Value, [caseless]),
+ case re:run(apply(Rec,Key,[]), MP) of
+ {match,_} -> true;
+ match -> true;
+ _ -> false
end;
test_rec(Rec,{Key, 'not_matches', Value}) ->
not test_rec(Rec,{Key, 'matches', Value});

0 comments on commit 277c6d7

Please sign in to comment.