From: Dan Moseley Date: Fri, 26 Jul 2019 21:00:30 +0000 (-0700) Subject: Update to MatchEvaluator NRE change (dotnet/corefx#39813) X-Git-Tag: submit/tizen/20210909.063632~11031^2~831 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=207377696666ae59a74113492fb35df8d71ea572;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Update to MatchEvaluator NRE change (dotnet/corefx#39813) * Update to MatchEvaluator NRE change * lowercase Commit migrated from https://github.com/dotnet/corefx/commit/c4e71057d8f2d9717316939584ef046147cefe2f --- diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Replace.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Replace.cs index cb78992..0d94527 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Replace.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Replace.cs @@ -186,7 +186,9 @@ namespace System.Text.RegularExpressions vsb.Append(input.AsSpan(prevat, match.Index - prevat)); prevat = match.Index + match.Length; - vsb.Append(evaluator(match) ?? ""); + string result = evaluator(match); + if (!string.IsNullOrEmpty(result)) + vsb.Append(result); if (--count == 0) break;