From 48a69608f586183c08c41f9d1373a1a21b19e723 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 25 Apr 2021 00:04:08 +0200 Subject: Fix UnicornFormatWithEnvironment --- src/IOL.Helpers/StringHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IOL.Helpers/StringHelpers.cs b/src/IOL.Helpers/StringHelpers.cs index 3f80d6e..0c25184 100644 --- a/src/IOL.Helpers/StringHelpers.cs +++ b/src/IOL.Helpers/StringHelpers.cs @@ -29,9 +29,9 @@ namespace IOL.Helpers public static string UnicornFormatWithEnvironment(this string input, IConfiguration configuration) { if (string.IsNullOrWhiteSpace(input)) return default; - var matchList = Regex.Matches(input, ""); + var matchList = Regex.Matches(input, "{[a-z|_]*}", RegexOptions.IgnoreCase); foreach (var key in matchList.Select(match => match.Value)) { - var value = configuration.GetValue(key); + var value = configuration.GetValue(key.Substring(1, key.Length - 2)); if (string.IsNullOrWhiteSpace(value)) continue; input = input.Replace(key, value); } -- cgit v1.3