I am trying to match the following string and replace it with the first capture goup: PCUNIT020\Username; I need just the Username portion. I use the following regex:
$name="PCUNIT020\Username";
$regex="^\w+\\(.*)";
$newname=$name -replace $regex, $1;
$newname;
The shell does not output anything.