Last active
November 8, 2023 10:17
-
-
Save JimMoyle/04268d182da744e48ebf2cad3b21c346 to your computer and use it in GitHub Desktop.
Regex to Match a PowerShell cmdlet name or parameter in Pascal Case including Acronyms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cmdletName -cmatch "^(?:[A-Z]{1,3}(?:[a-z0-9_])+)+[A-Z]{0,2}-(?:[A-Z]{1,3}(?:[a-z0-9_])+)+[A-Z]{0,2}$" | |
$parameterName -cmatch '^(?:[A-Z]{1,3}(?:[a-z0-9_])+)+[A-Z]{0,2}$' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment