using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"var datas ?= ?\{ ?(?: ?""[^""]+"" ?: ?\{ ?""titre"" ?: ?(?:(?:""(?:[^""]|\\"")*[^\\]"")|(?:'(?:[^']|\\')*[^\\]')) ?, ?(?:""\d+"" ?: ?\d+ ?(?:(?:, ?(?=(?:""\d)|\}))|(?=\}))){1,} ?\} ?(?:(?:, ?(?=[""}]))|(?=\}))){2,7}\}";
string input = @"var datas = { ""XiaoMei"": { ""titre"" : ""Xiao-Mei"", ""0"" : 113, ""1"" : 39, ""2"" : 128, ""3"" : 386, ""4"" : 481, ""5"" : 69, ""6"" : 25, ""7"" : 142, ""8"" : 141, ""9"" : 32, ""10"" : 533, ""11"" : 27, ""12"" : 87, ""13"" : 125, ""14"" : 124, ""15"" : 98, ""16"" : 531 }, ""RossBelles"": { ""titre"" : ""Scott Ross, les + belles"", ""0"" : 1, ""1"" : 9, ""2"" : 14, ""3"" : 27, ""4"" : 38, ""5"" : 103, ""6"" : 114, ""7"" : 141, ""8"" : 208, ""9"" : 213, ""10"" : 296, ""11"" : 297, ""12"" : 298, ""13"" : 299, ""14"" : 380, ""15"" : 490, ""16"" : 491, ""17"" : 492, ""18"" : 555 }, ""Ross561"": { ""titre"" : ""Scott Ross, antho. 1"", ""0"" : 33, ""1"" : 34, ""2"" : 60, ""3"" : 67, ""4"" : 69, ""5"" : 87, ""6"" : 94, ""7"" : 95, ""8"" : 96, ""9"" : 97, ""10"" : 104, ""11"" : 107, ""12"" : 113, ""13"" : 114, ""14"" : 132, ""15"" : 133, ""16"" : 140, ""17"" : 141, ""18"" : 144, ""19"" : 145 }, ""Ross562"": { ""titre"" : ""Scott Ross, antho. 2"", ""0"" : 146, ""1"" : 178, ""2"" : 187, ""3"" : 201, ""4"" : 203, ""5"" : 204, ""6"" : 205, ""7"" : 208, ""8"" : 209, ""9"" : 211, ""10"" : 212, ""11"" : 213, ""12"" : 214, ""13"" : 238, ""14"" : 239, ""15"" : 259, ""16"" : 260 }, ""Ross563"": { ""titre"" : ""Scott Ross, antho. 3"", ""0"" : 241, ""1"" : 261, ""2"" : 262, ""3"" : 298, ""4"" : 318, ""5"" : 319, ""6"" : 364, ""7"" : 365, ""8"" : 366, ""9"" : 381, ""10"" : 402, ""11"" : 403, ""12"" : 426, ""13"" : 427, ""14"" : 429, ""15"" : 455, ""16"" : 513, ""17"" : 544, ""18"" : 545 }, ""Staier"": { ""titre"" : ""Staier"", ""0"" : 427, ""1"" : 426, ""2"" : 415, ""3"" : 414, ""4"" : 209, ""5"" : 208, ""6"" : 247, ""7"" : 246, ""8"" : 513, ""9"" : 216, ""10"" : 215, ""11"" : 114, ""12"" : 113, ""13"" : 69, ""14"" : 116, ""15"" : 115, ""16"" : 395, ""17"" : 394} }
";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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