 <p>If you run your regex snippet in a C# program, I have the solution for you:</p> <pre class="lang-cs prettyprint-override"><code>Regex regex = new Regex(@"(?&lt;=\{{1}[\s\r\n]*)((?&lt;Attribute&gt;[^}:\n\r\s]+):\s+(?&lt;Value&gt;[^;]*);[\s\r\n]*)*(?=\})"); regex.Replace(input, match =&gt; { var replacement = string.Empty; for (var i = 0; i &lt; match.Groups["Attribute"].Captures.Count; i++) { replacement += string.Format(CultureInfo.InvariantCulture, "{0}: {1}\r\n", match.Groups["Attibute"].Captures[i], match.Groups["Value"].Captures[i]); } return replacement; }); </code></pre>