private static string getKeyValue(ref string Line, string WordToFind) >{ > var retVal = string.Empty; > > if (Line.Contains(WordToFind)) > { > Regex r = new Regex(@"(?:(?'Key'\S+): (?'Value'(?:.(?!\s+\S+:))*))", > RegexOptions.RightToLeft | > RegexOptions.CultureInvariant | > RegexOptions.Compiled); > > var matches = r.Matches(Line); > > var wordMatch = matches.OfType<Match>().Where(match => match.Groups["Key"].Value == WordToFind); > if (wordMatch.Any()) > { > retVal = wordMatch.First().Groups["Value"].Value; > } > } > > return retVal; >}