Function parameters can be validated using standard regular expressions. For example, the next template function accepts only valid Knowledge Base article numbers beginning with "KB" and a six- digit number:
function Get-KnowledgeBaseArticle {
param(
[ValidatePattern('^KB\d{6}$')]
[String]
$KB
)
param(
[ValidatePattern('^KB\d{6}$')]
[String]
$KB
)
"You entered Knowledgebase ID $KB"
}