using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
string content= "##{‘name’ : ‘Account' , ‘placeholder’ : ‘Enter Accountant Name’, ‘label’ : ‘Account Name’ , ‘type’ : ‘string’ , ‘mode’: ‘multiline’}## _______________ referred to as ACCOUNTANT, and [{ ‘Client Name’: ‘Sterling Accountancy’, ‘Type’ : ‘string’, ‘Length’: 255 }] _________________, referred to as CLIENT, agree: ACCOUNTANT shall furnish accounting services to CLIENT, to be billed monthly at the standard rates for ACCOUNTANT and staff. The following services shall be provided by ACCOUNTANT: [{‘Description’: ‘Job description’, ‘Type’ : ‘String’, ‘Length’: ‘2000’}]##{‘name’ : ‘Account’ , ‘placeholder’ : ‘Enter Accountant Name’ , ‘label’ : ‘Account Name’ , ‘type’ : ‘string’ , ‘mode’: ‘multiline’}##";
List<TemplateModel> mainTemplateFields = new List<TemplateModel>();
Regex ItemRegex = new Regex(@"(##)(.*?)(##)", RegexOptions.Compiled);
foreach (Match ItemMatch in ItemRegex.Matches(content))
var value = ItemMatch.Value.Trim();
value = value.Replace("#", String.Empty);
var list = JsonConvert.DeserializeObject<TemplateModel>(ss);
Console.WriteLine(list.name);
mainTemplateFields.Add(list);
public class TemplateModel
public string name { get; set; }
public string type { get; set; }
public string placeholder { get; set; }
public string label { get; set; }
public string mode { get; set; }