diff --git a/loopy/context_matching.py b/loopy/context_matching.py
index 27a93c8168fdb70a2e30912bef37a4782953a03c..57ccf9d27abe2e1d78dbcf7fdd7d852efb8e9771 100644
--- a/loopy/context_matching.py
+++ b/loopy/context_matching.py
@@ -95,7 +95,7 @@ def parse_id_match(id_matches):
     def re_from_glob(s):
         import re
         from fnmatch import translate
-        return re.compile(translate(s.strip()))
+        return re.compile("^"+translate(s.strip())+"$")
 
     if not isinstance(id_match, tuple):
         components = id_match.split("$")