using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @".*сума[:\s]+(?<suma>\d{1,5}[.,]\d{1,2}).*(?<pan>[0-9X\*]{16}).*термі.*(?<terminalId>[A-Z0-9]{8,10}).*код автор.*(?<approvalCode>\d{1,6}).*чек.*(?<chq>\d{1,10}).*rrn[:\s]+(?<rrn>\d{1,12})";
string input = @"ПРИВАТБАНК\nМАГАЗИН Xxxxxx\nвул.Кручковського,буд.5Б\nс.Нагачiв\nФОП XXXXX Б.Б.\n2517109510\nОПЛАТА\nСУМА:1.25 ГРН\n\n************4211\nContactless\nMASTERCARDAID: A0000000041010\nТЕРМIНАЛ # S11800CC20 ЛЮТ 2024 18:49:02\nКОД АВТОРИЗ.: 463521ЧЕК N: 436084\nRRN: 080469527205\n\n(с)SSI 2023 PRIVATBANK v.T5PRVa_.04E\nSmartPos_EMV 01.001\n";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
Match m = Regex.Match(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