I want to replace the value in an XML using PowerShell. I have below string (a part of XML) want to replace 100 with different value
<stringProp 79357name="ThreadGroup.79357num_threads">100</stringProp>
I have tried below code which identify the required value but while replacing it replace all the numeric value
$DN = '<stringProp 79357name="ThreadGroup.79357num_threads">100</stringProp>'
$test =10000
[regex]$rx='^ThreadGroup.79357num_threads">(.+?)</stringProp>$'
$rx.Match($DN)
$DN = $rx.Replace($DN,'$1') -replace '\d+',$test
Write-Host $DN
After running above code I am getting below output
<stringProp 10000name="ThreadGroup.10000num_threads">10000</stringProp>
and am expecting
<stringProp name="ThreadGroup.10000num_threads">10000</stringProp>