From 6849ae856b31950be630e453318d93a7d69f6bee Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 25 Aug 2006 12:13:37 -0400 Subject: [PATCH] ENH: Globbing patterns should not match a slash inside a filename component. --- Source/kwsys/Glob.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index d86b9e052..7ef2fed30 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/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 == '[') {