using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\s*";
string substitution = @"<h1>$1</h1><p>$2</p><br><p>$3</p><br><p>$4</p><br><p>$5</p>";
string input = @"1 Question
2 Answer 1
3 Answer 2
4 Answer 3
5 Answer 4
6 Answer 5
7 Question
8 Answer 1
9 Answer 2
10 Answer 3
11 Answer 4
12 Answer 5";
Regex regex = new Regex(pattern);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx