|
RE: Powershell Operator Complementing Keith's answer:
# the -like operator does wildcard comparison
# the -match operator does RegEx comparison
# $check contains RegEx special characters that must be escaped to
# include them in the pattern. Remove the '*' and call [RegEx]'s
# Escape Method to create an escaped RegEx
$version = "Microsoft(R) Windows(R) Server 2003, Enterprise Edition"
$check = "Microsoft(R) Windows(R) Server 2003"
$version -match [regex]::escape($check)
# these are the RegEx special characters that must be escaped
#.$^{[()*+?\|
--
Kiron |