Ragged pattern stem excludes wildcard segments in StartsWith group
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
When using a glob pattern with a wildcard segment before `**` (e.g., `sys*/**/*.dll`), the Stem of matched files
does not include the portion matched by the wildcard prefix. This is inconsistent with how linear patterns
(without `**`) handle the same wildcard segments.
```csharp
using Microsoft.Extensions.FileSystemGlobbing;
var matcher = new Matcher();
matcher.AddInclude("sys*/**/*.dll");
var files = new[]
{
"system32/drivers/acpi.dll",
"system32/drivers/usb.dll",
"system32/config/sam.dll",
"system32/config/security.dll",
};
var results = matcher.Match("./", files);
var actual = results.Files.Select(f => f.Stem);
foreach (var item in actual)
{
Console.WriteLine(item);
}
```
`sys*` is a wildcard segment that matched `system32`, so `system32` should be part of the stem, based on the [docs](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.filesystemglobbing.filepatternmatch.stem?view=net-10.0-pp).
Contributor guide
Assessment
This issue has not been assessed yet.