using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\d{2})\/(\d{2})\/(\d{2})\s+(\d{2}):(\d{2})\s+([\d]+)\s+([\d]+|)\s+(<I>|)(EXT|)([\w]+|)(\s+|)((\d{1})'(\d{2})|)(\s+|)((\d{2}):(\d{2})'(\d{2})\s+(.*) |)";
string input = @"01/02/16 09:37 1142 01 2286542PPPPPP9131874263 00:00'24
01/02/16 09:37 1204 48 2181 00:01'33
01/02/16 09:37 1221 33 <I>3342 0'00 00:01'25 TR
01/02/16 09:38 1232 02 2286542PPPPPP9082035024 00:00'12
01/02/16 09:39 1711 EXT1132
01/02/16 09:39 1232 01 2286542PPPPPP9082035024 00:00'02
01/02/16 09:39 5910 11 <I> 0'01 00:00'37 D0
01/02/16 09:39 1602 EXT1611
01/02/16 09:39 1332 EXT1204
01/02/16 09:40 1222 34 <I>3933 0'02 00:00'14
01/02/16 09:40 1232 EXT1393
01/02/16 09:41 1262 EXT1154
03/02/16 16:11 2181 EXT2421
03/02/16 16:13 2181 05 89509600795 00:00'47
03/02/16 16:13 2314 24 1242 00:00'08
03/02/16 15:07 2162 05 <I> 0'00 00:00'15 TR
03/02/16 15:09 2004 05 <I> 0'05 00:00'50
03/02/16 15:11 2004 05 <I> 0'38 00:00'00 NA
03/02/16 15:12 2004 06 <I> 0'11 00:00'26
03/02/16 15:16 2004 05 <I> 0'04 00:01'02
03/02/16 15:18 2181 17 <I>1396 0'04 00:12'23
03/02/16 15:20 2151 07 89020100016 00:00'17
03/02/16 15:21 2004 24 1132 00:00'24 TR
03/02/16 15:21 2004 05 <I> 0'05 00:01'37
03/02/16 15:21 2151 07 89509668727 00:00'22
03/02/16 15:23 2151 05 89020116661 00:00'20
01/02/16 09:31 5910 11 <I> 0'01 00:00'24 D0
01/02/16 09:31 1221 33 <I>4351 0'00 00:04'55 TR
01/02/16 09:31 5910 03 <I>89831514875 0'01 00:00'14 D0
01/02/16 09:32 1204 11 <I> 0'00 00:00'45 TR
01/02/16 09:32 1125 03 <I>89831514875 0'00 00:00'16 TR
01/02/16 09:32 5910 03 <I>89831514875 0'01 00:00'13 D0
01/02/16 09:32 5910 09 <I> 0'01 00:00'10 D0 ";
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