Update to MatchEvaluator NRE change (dotnet/corefx#39813)
authorDan Moseley <danmose@microsoft.com>
Fri, 26 Jul 2019 21:00:30 +0000 (14:00 -0700)
committerGitHub <noreply@github.com>
Fri, 26 Jul 2019 21:00:30 +0000 (14:00 -0700)
* Update to MatchEvaluator NRE change

* lowercase

Commit migrated from https://github.com/dotnet/corefx/commit/c4e71057d8f2d9717316939584ef046147cefe2f

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.Replace.cs

index cb78992..0d94527 100644 (file)
@@ -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;