I'm trying to match the first occurence of a string using PowerShell:
$virtualMachine1 = "002DC001"
$virtualMachine2 = "003SP002"
$virtualMachine1 -match "002"
True
Good
$virtualMachine2 -match "002"
True
Bad.
Is there a way to match only the first 002
in the string? I think regex is required but I am stuck.