Open Crell opened 1 month ago
Docs state /**/`` matches zero or more directory names
: don't have any more context than that myself either :|
I see that the tests aren't matching descendants: https://github.com/webmozarts/glob/blob/6712c9c4a8b0f6f629303bd1b26b9f88339d901e/tests/GlobTest.php#L93-L122
I'm trying to filter some paths, where I want to use **. Unfortunately, the regex that's getting computed internal to
Glob::filter()
seems to be incorrect.For example, the pattern
/**
compiles to~^/[^/]*[^/]*$~
. That will match/
,/foo
,/bar
, but not/foo/bar
. I believe it should be matching/foo/bar
.Similarly, the pattern
/foo/**
compiles to~^/foo/[^/]*[^/]*$~
. That will match/foo
,/foo/bar
, but not/foo/bar/baz
.So either there is a bug in the regex compiler in handling , or I'm not understanding `` properly. I suppose either is possible. If there is some other way I should be doing this, please advise. (In practice I think I only need prefix-matching, but was trying to use a full glob for it for flexibility.)