◐ Shell
clean mode source ↗

Add ToRegex method to WildcardPattern class by yotsuda · Pull Request #26515 · PowerShell/PowerShell

- Add public ToRegex() method to convert wildcard patterns to regex
- Leverage existing internal PatternConvertedToRegex property
- Include comprehensive XML documentation with examples
- Add 13 Pester tests covering various scenarios

@iSazonov added the CL-General

Indicates that a PR should be marked as a general cmdlet change in the Change Log

label

Nov 24, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Address Copilot review feedback:
- Use -BeExactly instead of -Match for precise regex validation
- Fix question mark test: ? converts to . (single char), not .*
- Fix escaped wildcard test: use single quotes to preserve backtick
- Add clarifying comments for test intentions

iSazonov

Address review feedback to check exactly expected strings
in all tests instead of using -Match assertions.

iSazonov

Add tests for trailing .*$ and both-end optimization

iSazonov

@yotsuda

iSazonov

@yotsuda

MatejKafka

@yotsuda

@yotsuda

iSazonov

@yotsuda

iSazonov

@yotsuda yotsuda deleted the feature/issue-19992-wildcard-toregex branch

December 10, 2025 21:46

SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request

Dec 12, 2025

kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request

Jan 2, 2026

JustinGrote pushed a commit to JustinGrote/PowerShell that referenced this pull request

Jun 2, 2026