diff --git a/Glob.cxx b/Glob.cxx
index 6fe21d1e2ed649fb35532bd29a467352fd0f46c8..0923fb2ed1738251c735a1378ece198bdce1dcd8 100644
--- a/Glob.cxx
+++ b/Glob.cxx
@@ -92,12 +92,18 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
     if(c == '*')
       {
       // A '*' (not between brackets) matches any string.
-      regex += ".*";
+      // We modify this to not match slashes since the orignal glob
+      // pattern documentation was meant for matching file name
+      // components separated by slashes.
+      regex += "[^/]*";
       }
     else if(c == '?')
       {
       // A '?' (not between brackets) matches any single character.
-      regex += ".";
+      // We modify this to not match slashes since the orignal glob
+      // pattern documentation was meant for matching file name
+      // components separated by slashes.
+      regex += "[^/]";
       }
     else if(c == '[')
       {