February 2019
Intermediate to advanced
626 pages
15h 51m
English
ValidatePattern is used to test that a string, or the elements in an array of strings, matches the supplied pattern:
function Test-ValidatePattern { [CmdletBinding()] param ( [ValidatePattern('^Hello')] [String]$Parameter1 )}
In addition to the pattern argument, ValidatePattern accepts RegexOptions using the Options named parameter, for example:
function Test-ValidatePattern { [CmdletBinding()] param ( [ValidatePattern('^Hello', Options = 'Multiline')] [String]$Parameter1 )}
The possible values for Options are described by the System.Text.RegularExpressions.RegexOptions enumeration, which is documented in the .NET reference (https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regexoptions?view=netframework-4.7.2 ...
Read now
Unlock full access