using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=Location:[^(]*\([^(]*\()[^)]*(?=\))";
string input = @"--batchresponse_bla_bla_bla_
--changesetresponse__bla_bla_bla_
Location: https://site.ru/CRM/api/data/v9.0/gm_preorders(a341eb4e-2fdf-eb11-a30b-ac1f6b465e3b)
OData-EntityId: https://site.ru/CRM/api/data/v9.0/gm_preorders(a341eb4e-2fdf-eb11-a30b-ac1f6b465e3b)
_bla_bla_bla_
--changesetresponse__bla_bla_bla_Location: https://site.ru/CRM/api/data/v9.0/gm_preorders(a841eb4e-2fdf-eb11-a30b-ac1f6b465e3b)
OData-EntityId: https://site.ru/CRM/api/data/v9.0/gm_preorders(a841eb4e-2fdf-eb11-a30b-ac1f6b465e3b)
_bla_bla_bla_
--changesetresponse_n_bla_bla_bla_
Location: https://site.ru/CRM/api/data/v9.0/gm_preorders(74748d08-2ee6-eb11-a30b-ac1f6b465e3b)
OData-EntityId: https://site.ru/CRM/api/data/v9.0/gm_preorders(74748d08-2ee6-eb11-a30b-ac1f6b465e3b)
n_bla_bla_bla_
--changesetresponse_etc";
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