Created
June 19, 2023 12:08
-
-
Save fokklz/6396939ddd740808a9b079dc7f2573d6 to your computer and use it in GitHub Desktop.
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
function ValidateUsername { | |
param( | |
[Parameter(Position = 0)] | |
[string]$Username | |
) | |
$onlyLetters = "[a-zA-Z]" | |
$blacklist = @("admin", "administrator") | |
if($Username -notmatch $onlyLetters){ | |
return $false | |
} | |
if($blacklist -contains $Username){ | |
return $false | |
} | |
return $true | |
} | |
ValidateUsername "admin" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment