Forum Discussion
Asterisk (*) wildcard at end of string not matching file
Hi, Michael.
I can't reproduce the issue you're seeing in either Windows PowerShell or PowerShell, but I can at least confirm your understanding of the asterisk wildcard is correct insofar as it means "zero or more characters".
As you've noted, it's not actually a regular expression being used here but a pattern matching implementation contained within the file system API itself, which is why the pattern matching is the same in PowerShell as the "dir" command from the command prompt (i.e. DOS command window). For this reason, it's hard to comprehend why you're seeing what you're seeing.
For posterity, I ran the following tests with identical results across all three:
Get-ChildItem -File -Filter "*xlsx*";
Get-ChildItem -File -Filter "*xlsx";
Get-ChildItem -File -Filter "*xl*sx*";
It won't provide any resolution, but it would be interesting to try the same patterns in a DOS "dir" command (example below) to see if you get the same result as in PowerShell (i.e. if the issue is PowerShell specific or something with wider reach).
Without being able to reproduce the issue, there's nothing I can really offer.
Cheers,
Lain