Path.wildcard documentation states `*` matches any character up to the next dot, when it fact it does not?

I’d like to check my understanding of the Path.wildcard/2 documentation

It states:

* - matches any number of characters up to the end of the filename, the next dot, or the next slash.

However, the following wildcard: Path.wildcard("**/*.ex") matches the file lib/test.pb.ex. But if the documentation is to be believed, it shouldn’t match as the * should only match up to the dot between test and pb, and the remaining pattern .ex does not match pb.ex.

What’s going on here? Is this a bug, is the documentation wrong, or is my understanding incorrect?


That phrase is directly from the docs for :filelib.wildcard in the Erlang stdlib (not surprising, since Path.wildcard is mostly parameter-formatting around that function), but I don’t see any tests for the “two extensions” behavior in the filelib specs. :thinking:

* likely does a greedy match. Not sure if file patterns obey the same rules but IIRC at least with regexes using *? will match less greedily.

Plus your observed behavior is what I’d expect btw. This pattern is supposed to match that file name. Can’t speak for the docs in particular but to me that code is working as expected.