Doug Robinson wrote on Tue, Mar 28, 2017 at 09:05:53 -0400:
> Daniel:
>
> Sorry for the delay - I missed the post.
No worries.
> That said, in discussions I've had I think about the SVN regex "**"
> differently than the zsh construct. The way that I interpret "/**" is
> "everything below and including slash" - so "**" is the moral equivalent of
> Perl's ".*" wildcard. It need not be followed by any terminal pattern to
> match anything - since it matches them all. If it was followed by
> something then that something would be required.
>
Note that your terminology is backwards: "**" is a wildcard and ".*" is
a regex.
> So let me break the 3 patterns down:
>
> /*/*/** This requires 2 directories. It will match all directories 2
> levels down - and then everything in all of the rest of those trees however
> deep. It should not, however, match a file or symlink in a directory, e.g.
> "/dirA/fileB". Whereas it will match "/dirA/dirB" along with
> "/dirA/dirB/fileC", etc.
That's an interesting one. Neither vim nor zsh matches dirA/dirB here —
they only match dirents _under_ it — but it's certainly defensible to
match it, exactly as you say.
To clarify, if foo/bar is a symlink then it is not a directory, no
matter what its target is and what else exists in the repository. (In
particular, if its target is "baz" and foo/baz/ exists, foo/bar is still
not a directory.)
So, for example, [foo/bar/**] would apply to foo/bar/, iff it exists and
is a directory. That sounds good.
> /*/**/* This requires 1 directory and then something else. It will match
> "/dirA/fileB" or "/dirA/symlinkX" since "/**" can simply go to nothing. Or
> perhaps a different way to look at it is that "/**" can match "/" which, in
> its simplest will mean "/*/**/*" becomes "/*//*" and given that multiple
> '/' always collapse to a single '/' in "path arithmetic" becomes "/*/*" for
> its shortest match.
Agreed.
> /**/*/* This requires 1 directory and then something else. Pretty much
> the same as the prior example and for the same reasons.
Agreed.
Thanks,
Daniel
Received on 2017-03-28 23:48:40 CEST