using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"SID_W_MAX_TRAN_DT.+?=(?=\s) (?<SID_W_MAX_TRAN_DT>[^\s]+)";
string input = @"MID_COUNT =========== 20,588,655
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
Table.+.+?(?=\.)\W*(schema.table_name)\W.+?(?=,+)\,\s+numRows\=+(?<LogTime>[^\,]+)
Loading data to table schema.table_name
Table gmr.opcode_tedc_cs_gmr_id_delta stats: [numFiles=5, numRows=8986691, totalSize=937732401, rawDataSize=928745710]
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 997 100 997 0 0 114k 0 --:--:-- --:--:-- --:--:-- 162k
0 0 0 397 0 0 1650 0 --:--:-- --:--:-- --:--:-- 1650
SID_W_MAX_TRAN_DT ========== 9,070,691
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 997 100 997 0 0 108k 0 --:--:-- --:--:-- --:--:-- 139k
0 0 0 403 0 0 944 0 --:--:-- --:--:-- --:--:-- 944
NON_PSP_SID_COUNT =========== 39,869,169
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 997 100 997 0 0 112k 0 --:--:-- --:--:-- --:--:-- 162k
0 0 0 398 0 0 7223 0 --:--:-- --:--:-- --:--:-- 7223
PSP_SID_COUNT =========== 45,083
";
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