using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^.*\\r\\n\|\*(Task 1)\*\|(.*)\|(.*)\|(.*)\|(.*)\|\\r\\n\|\*(Task 2)\*\|(.*)\|(.*)\|(.*)\|(.*)\|\\r\\n\|\*(Task 3)\*\|(.*)\|(.*)\|(.*)\|(.*)\|\\r\\n\|\*(Task 4)\*\|(.*)\|(.*)\|(.*)\|(.*)\|$";
string substitution = @"{""ACTION"":[{""TITLE"":""$1"",""DUE DATE"":""$2"",""DONE ON"":""$3"",""NOTE"":""$5""},{""TITLE"":""$6"",""DUE DATE"":""$7"",""DONE ON"":""$8"",""NOTE"":""$10""},{""TITLE"":""$11"",""DUE DATE"":""$12"",""DONE ON"":""$13"",""NOTE"":""$15""},{""TITLE"":""$16"",""DUE DATE"":""$17"",""DONE ON"":""$8"",""NOTE"":""$20""}]}";
string input = @"|| ||Du Date||Done on||OK/NOK||Remarks||\r\n|*Task 1*| | | | |\r\n|*Task 2*| | | | |\r\n|*Task 3*| | | | |\r\n|*Task 4*| 15/03/23| | | See document X|";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
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