Switch -Regex in Powershell.

Posted by CrazyNick on Stack Overflow See other posts from Stack Overflow or by CrazyNick
Published on 2010-03-27T08:55:37Z Indexed on 2010/03/27 9:03 UTC
Read the original article Hit count: 359

$source |% {
switch -regex ($_){
**'\<'+$primaryKey+'\>(.+)\</'+$primaryKey+'\>**' { 
$primaryKeyValue = $matches[1]; continue; }

}

I want to use dynamic key value with switch-regex, is that possible?

© Stack Overflow or respective owner

Switch -Regex in Powershell.

Posted by CrazyNick on Server Fault See other posts from Server Fault or by CrazyNick
Published on 2010-03-27T09:03:24Z Indexed on 2010/03/27 9:13 UTC
Read the original article Hit count: 359

$source |% { switch -regex ($_){ '\<'+$primaryKey+'>(.+)\' {
$primaryKeyValue = $matches[1]; continue; }

} I want to use dynamic key value with switch-regex, is that possible?

© Server Fault or respective owner

Related posts about powershell

Related posts about powershell-v2.0