Fix the pref regression to the '-replace' operator after adding ScriptBlock support (#7135)

This commit is contained in:
Bruce Payette
2018-06-26 12:27:16 -07:00
committed by Dongbo Wang
parent 13e925e13e
commit bacda46941
@@ -908,7 +908,7 @@ namespace System.Management.Automation
pattern = rList[0];
if (rList.Count > 1)
{
substitute = rList[1];
substitute = PSObject.Base(rList[1]);
}
}
}
@@ -972,6 +972,9 @@ namespace System.Management.Automation
{
switch (substitute)
{
case string replacementString:
return regex.Replace(input, replacementString);
case ScriptBlock sb:
MatchEvaluator me = match => {
var result = sb.DoInvokeReturnAsIs(