diff --git a/lib/Lacuna/DB.pm b/lib/Lacuna/DB.pm index a851330f..da0e5c06 100644 --- a/lib/Lacuna/DB.pm +++ b/lib/Lacuna/DB.pm @@ -27,14 +27,14 @@ sub _where elsif ($id =~ /[%_]/) { $where{$type} = { like => $id }; } - # or just the name (hopefully no names are purely numeric) - elsif ($id =~ /\D/) { - $where{$type} = $id; - } # or the numeric ID (probably most useful for testing) - else { + elsif ($id =~ /^#?-?\d+$/) { $where{id} = $id; } + # or just the name (hopefully no names are purely numeric) + else { + $where{$type} = $id; + } \%where; }