private string ExtractSection()

in src/Microsoft.Azure.WebJobs.Extensions.Kafka/Output/KafkaProducerFactory.cs [103:115]


        private string ExtractSection(string pemString, string sectionName)
        {
            if (!string.IsNullOrEmpty(pemString))
            {
                var regex = new Regex($"-----BEGIN {sectionName}-----(.*?)-----END {sectionName}-----", RegexOptions.Singleline);
                var match = regex.Match(pemString);
                if (match.Success)
                {
                    return match.Value.Replace("\\n", "\n");
                }
            }
            return null;
        }