Created
March 4, 2019 18:15
-
-
Save RobBiddle/d88d7c760dd363715f3c1cc0f4caba97 to your computer and use it in GitHub Desktop.
PowerShell Parameter ValidatePattern (REGEX) validation check which will match either a valid GUID or a valid FQDN
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
[Parameter] | |
[ValidatePattern( '(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)|(\{|\()?[A-Za-z0-9]{4}([A-Za-z0-9]{4}\-?){4}[A-Za-z0-9]{12}(\}|\()?' )] | |
[System.String] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment