using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?#SNILS)OID\.1\.2\.643\.100\.3=(\d{11})";
string input = @"Субъект: CN=Комитет по природным ресурсам Ленинградской области, SN=Комаров, G=Алексей Петрович, C=RU, S=78 г.Санкт-Петербург, L=Санкт-Петербург, STREET=""ул.Торжковская, д.4"", O=Комитет по природным ресурсам Ленинградской области, OU=Департамент лесного комплекса, T=Главный специалист, OID.1.2.643.100.1=1077847192609, OID.1.2.643.100.3=07311996668, OID.1.2.643.3.131.1.1=007842354966, E=ap_komarov@lenreg.ru";
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