View Single Post
Old 08-18-2008   #3 (permalink)
Kryten


 
 

Re: Powershell Operator

Hi AdityaKir,

Kiron's post pretty much says it all.
One possible way to express $check in order to get a match with
$version would be:-

Kryten -->$version = "Microsoft(R) Windows(R) Server 2003, Enterprise
Edition"
Kryten -->$check = "Microsoft\(R\) Windows\(R\) Server 2003*"
Kryten -->$version -match $check
True
Kryten -->$matches

Name Value
---- -----
0 Microsoft(R) Windows(R) Server 2003

Here $check has all the '(' and ')' s escaped with the '\'.

From studying previous posts from those waaaay more knowledgable than
I'll _ever_ be I learned that treating
the -match value as a regex was generally a good idea and I've had a
lot more success with it since.

Good luck,
Stuart
My System SpecsSystem Spec