using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"""title"":\s*""([^""]*)"".*?""weight"":\s*([0-9]+)";
string input = @"[
{
""json"": ""[\n {\n \""data\"": {\n \""product\"": {\n \""id\"": 23349897,\n \""created_at\"": \""2022-12-15T10:38:48+00:00\"",\n \""updated_at\"": \""2024-10-06T18:14:29+00:00\"",\n \""source\"": \""Reseller\"",\n \""source_ref\"": \""SUPPRIMER1\"",\n \""user_ref\"": \""EXT17\"",\n \""stock\"": 541,\n \""ean13\"": \""9780201379648\"",\n \""title\"": \""Instant Boost Botox\"",\n \""location\"": \""\"",\n \""picture_url\"": \""https://cdn.shopify.com/s/files/1/0083/9886/4480/products/image_600x.png?v=1674466007\"",\n \""weight\"": 640,\n \""height\"": null,\n \""length\"": null,\n \""width\"": null,\n \""unit_volume\"": null,\n \""stock_volume_in_m3\"": null,\n \""hs_code\"": \""33059000\"",\n \""supplier\"": null,\n \""pack_components\"": [],\n \""pack_product_ids\"": [],\n \""product_logistic_units\"": [],\n \""eco_tax_cents\"": \""0.0\"",\n \""eco_tax_currency\"": null,\n \""tax_rate\"": null,\n \""other_ref1\"": null,\n \""other_ref2\"": null,\n \""other_ref3\"": null,\n \""other_ref4\"": null,\n \""other_ref5\"": null,\n \""other_ref6\"": null,\n \""other_ref7\"": null,\n \""other_ref8\"": null,\n \""other_ref9\"": null,\n \""other_ref10\"": null,\n \""other_ref11\"": null,\n \""other_ref12\"": null,\n \""other_ref13\"": null,\n \""other_ref14\"": null,\n \""other_ref15\"": null,\n \""additional_references\"": [],\n \""total_physical_stock\"": 0,\n \""supplier_product_ids\"": [],\n \""product_additional_fields\"": [\n {\n \""id\"": 1284855,\n \""created_at\"": \""2024-02-16T10:16:38+00:00\"",\n \""updated_at\"": \""2024-02-16T10:16:38+00:00\"",\n \""product_id\"": 23349897,\n \""key\"": \""customOriginCountry\"",\n \""value\"": \""FR\""\n }\n ],\n \""product_instructions_files\"": []\n }\n },\n \""quantity\"": 1,\n \""product_user_ref\"": \""EXT17\""\n },\n {\n \""data\"": {\n \""product\"": {\n \""id\"": 23349890,\n \""created_at\"": \""2022-12-15T10:38:47+00:00\"",\n \""updated_at\"": \""2024-10-06T17:09:47+00:00\"",\n \""source\"": \""Manual product\"",\n \""source_ref\"": \""EXT08\"",\n \""user_ref\"": \""EXT08\"",\n \""stock\"": 1567,\n \""ean13\"": \""9780201349870\"",\n \""title\"": \""Shampoing Bain de Soie\"",\n \""location\"": \""\"",\n \""picture_url\"": \""https://cdn.shopify.com/s/files/1/0083/9886/4480/products/SHAMPOOINGPRE-FORME_39_600x.png?v=1668241257\"",\n \""weight\"": 370,\n \""height\"": null,\n \""length\"": null,\n \""width\"": null,\n \""unit_volume\"": null,\n \""stock_volume_in_m3\"": null,\n \""hs_code\"": \""33059000\"",\n \""supplier\"": null,\n \""pack_components\"": [],\n \""pack_product_ids\"": [],\n \""product_logistic_units\"": [],\n \""eco_tax_cents\"": \""0.0\"",\n \""eco_tax_currency\"": \""EUR\"",\n \""tax_rate\"": null,\n \""other_ref1\"": null,\n \""other_ref2\"": null,\n \""other_ref3\"": null,\n \""other_ref4\"": null,\n \""other_ref5\"": null,\n \""other_ref6\"": null,\n \""other_ref7\"": null,\n \""other_ref8\"": null,\n \""other_ref9\"": null,\n \""other_ref10\"": null,\n \""other_ref11\"": null,\n \""other_ref12\"": null,\n \""other_ref13\"": null,\n \""other_ref14\"": null,\n \""other_ref15\"": null,\n \""additional_references\"": [],\n \""total_physical_stock\"": 0,\n \""supplier_product_ids\"": [],\n \""product_additional_fields\"": [\n {\n \""id\"": 1087243,\n \""created_at\"": \""2023-06-08T13:55:58+00:00\"",\n \""updated_at\"": \""2023-06-08T13:55:58+00:00\"",\n \""product_id\"": 23349890,\n \""key\"": \""customOriginCountry\"",\n \""value\"": \""IT\""\n }\n ],\n \""product_instructions_files\"": []\n }\n },\n \""quantity\"": 1,\n \""product_user_ref\"": \""EXT08\""\n },\n {\n \""data\"": {\n \""product\"": {\n \""id\"": 23349893,\n \""created_at\"": \""2022-12-15T10:38:48+00:00\"",\n \""updated_at\"": \""2024-10-06T17:09:47+00:00\"",\n \""source\"": \""Manual product\"",\n \""source_ref\"": \""EXT09\"",\n \""user_ref\"": \""EXT09\"",\n \""stock\"": 623,\n \""ean13\"": \""3700605869374\"",\n \""title\"": \""Masque profond Bain de Soie\"",\n \""location\"": \""\"",\n \""picture_url\"": \""https://cdn.shopify.com/s/files/1/0083/9886/4480/products/SHAMPOOINGPRE-FORME_40_600x.png?v=1668241226\"",\n \""weight\"": 365,\n \""height\"": null,\n \""length\"": null,\n \""width\"": null,\n \""unit_volume\"": null,\n \""stock_volume_in_m3\"": null,\n \""hs_code\"": \""33059000\"",\n \""supplier\"": null,\n \""pack_components\"": [],\n \""pack_product_ids\"": [],\n \""product_logistic_units\"": [],\n \""eco_tax_cents\"": \""0.0\"",\n \""eco_tax_currency\"": \""EUR\"",\n \""tax_rate\"": null,\n \""other_ref1\"": null,\n \""other_ref2\"": null,\n \""other_ref3\"": null,\n \""other_ref4\"": null,\n \""other_ref5\"": null,\n \""other_ref6\"": null,\n \""other_ref7\"": null,\n \""other_ref8\"": null,\n \""other_ref9\"": null,\n \""other_ref10\"": null,\n \""other_ref11\"": null,\n \""other_ref12\"": null,\n \""other_ref13\"": null,\n \""other_ref14\"": null,\n \""other_ref15\"": null,\n \""additional_references\"": [],\n \""total_physical_stock\"": 0,\n \""supplier_product_ids\"": [],\n \""product_additional_fields\"": [\n {\n \""id\"": 1087245,\n \""created_at\"": \""2023-06-08T13:55:58+00:00\"",\n \""updated_at\"": \""2023-06-08T13:55:58+00:00\"",\n \""product_id\"": 23349893,\n \""key\"": \""customOriginCountry\"",\n \""value\"": \""IT\""\n }\n ],\n \""product_instructions_files\"": []\n }\n },\n \""quantity\"": 1,\n \""product_user_ref\"": \""EXT09\""\n },\n {\n \""data\"": {\n \""product\"": {\n \""id\"": 23349896,\n \""created_at\"": \""2022-12-15T10:38:48+00:00\"",\n \""updated_at\"": \""2024-10-06T15:00:55+00:00\"",\n \""source\"": \""Reseller\"",\n \""source_ref\"": \""EXT13\"",\n \""user_ref\"": \""EXT13\"",\n \""stock\"": 291,\n \""ean13\"": \""9780201379648\"",\n \""title\"": \""Elixir N°1 Réparation\"",\n \""location\"": \""\"",\n \""picture_url\"": \""https://cdn.shopify.com/s/files/1/0083/9886/4480/files/mescheveuxsontuneextensiondequijesuis_13_600x.png?v=1684941023\"",\n \""weight\"": 200,\n \""height\"": null,\n \""length\"": null,\n \""width\"": null,\n \""unit_volume\"": null,\n \""stock_volume_in_m3\"": null,\n \""hs_code\"": \""33059000\"",\n \""supplier\"": null,\n \""pack_components\"": [],\n \""pack_product_ids\"": [],\n \""product_logistic_units\"": [],\n \""eco_tax_cents\"": \""0.0\"",\n \""eco_tax_currency\"": null,\n \""tax_rate\"": null,\n \""other_ref1\"": null,\n \""other_ref2\"": null,\n \""other_ref3\"": null,\n \""other_ref4\"": null,\n \""other_ref5\"": null,\n \""other_ref6\"": null,\n \""other_ref7\"": null,\n \""other_ref8\"": null,\n \""other_ref9\"": null,\n \""other_ref10\"": null,\n \""other_ref11\"": null,\n \""other_ref12\"": null,\n \""other_ref13\"": null,\n \""other_ref14\"": null,\n \""other_ref15\"": null,\n \""additional_references\"": [],\n \""total_physical_stock\"": 0,\n \""supplier_product_ids\"": [],\n \""product_additional_fields\"": [\n {\n \""id\"": 1284861,\n \""created_at\"": \""2024-02-16T10:16:38+00:00\"",\n \""updated_at\"": \""2024-02-16T10:16:38+00:00\"",\n \""product_id\"": 23349896,\n \""key\"": \""customOriginCountry\"",\n \""value\"": \""FR\""\n }\n ],\n \""product_instructions_files\"": []\n }\n },\n \""quantity\"": 1,\n \""product_user_ref\"": \""EXT13\""\n },\n {\n \""data\"": {\n \""product\"": {\n \""id\"": 23349901,\n \""created_at\"": \""2022-12-15T10:38:48+00:00\"",\n \""updated_at\"": \""2024-10-06T15:00:55+00:00\"",\n \""source\"": \""Reseller\"",\n \""source_ref\"": \""SUPPRIMER\"",\n \""user_ref\"": \""EXT18\"",\n \""stock\"": 1299,\n \""ean13\"": \""9780201379044\"",\n \""title\"": \""Dream Protect\"",\n \""location\"": \""\"",\n \""picture_url\"": \""https://cdn.shopify.com/s/files/1/0083/9886/4480/files/mescheveuxsontuneextensiondequijesuis_16_600x.png?v=1684944604\"",\n \""weight\"": 200,\n \""height\"": null,\n \""length\"": null,\n \""width\"": null,\n \""unit_volume\"": null,\n \""stock_volume_in_m3\"": null,\n \""hs_code\"": \""63023100\"",\n \""supplier\"": \""\"",\n \""pack_components\"": [],\n \""pack_product_ids\"": [],\n \""product_logistic_units\"": [],\n \""eco_tax_cents\"": \""0.0\"",\n \""eco_tax_currency\"": null,\n \""tax_rate\"": null,\n \""other_ref1\"": null,\n \""other_ref2\"": null,\n \""other_ref3\"": null,\n \""other_ref4\"": null,\n \""other_ref5\"": null,\n \""other_ref6\"": null,\n \""other_ref7\"": null,\n \""other_ref8\"": null,\n \""other_ref9\"": null,\n \""other_ref10\"": null,\n \""other_ref11\"": null,\n \""other_ref12\"": null,\n \""other_ref13\"": null,\n \""other_ref14\"": null,\n \""other_ref15\"": null,\n \""additional_references\"": [],\n \""total_physical_stock\"": 0,\n \""supplier_product_ids\"": [],\n \""product_additional_fields\"": [\n {\n \""id\"": 1284864,\n \""created_at\"": \""2024-02-16T10:16:38+00:00\"",\n \""updated_at\"": \""2024-02-16T10:16:38+00:00\"",\n \""product_id\"": 23349901,\n \""key\"": \""customOriginCountry\"",\n \""value\"": \""FR\""\n }\n ],\n \""product_instructions_files\"": []\n }\n },\n \""quantity\"": 1,\n \""product_user_ref\"": \""EXT18\""\n }\n]""
}
]";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
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