ENH: Globbing patterns should not match a slash inside a filename component.
This commit is contained in:
parent
b4e1de7886
commit
6849ae856b
@ -92,12 +92,18 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
|
|||||||
if(c == '*')
|
if(c == '*')
|
||||||
{
|
{
|
||||||
// A '*' (not between brackets) matches any string.
|
// 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 == '?')
|
else if(c == '?')
|
||||||
{
|
{
|
||||||
// A '?' (not between brackets) matches any single character.
|
// 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 == '[')
|
else if(c == '[')
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user