using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^.*_(.*)\/.*?(\d\d?)-(\d\d?)-(\d\d?)-(\d).*total images\/sec: (\d*).(\d*)$";
string substitution = @"\1\t\2\t\3\t\4\t\5\t\6,\7";
string input = @"tf_colocation_sync_alexnet/1-1-1-1//logs_han0001i_worker:total images/sec: 126.29
tf_colocation_sync_alexnet/2-2-2-1//logs_han0031i_worker:total images/sec: 284.09
tf_colocation_sync_alexnet/3-3-3-1//logs_han0028i_worker:total images/sec: 380.20
tf_colocation_sync_alexnet/4-4-4-1//logs_han0028i_worker:total images/sec: 433.71
tf_colocation_sync_alexnet/5-5-5-1//logs_han0031i_worker:total images/sec: 563.62
tf_colocation_sync_alexnet/6-6-6-1//logs_han0028i_worker:total images/sec: 650.25
tf_colocation_sync_alexnet/7-7-7-1//logs_han0028i_worker:total images/sec: 714.17
tf_colocation_sync_alexnet/8-8-8-1//logs_han0021i_worker:total images/sec: 771.35
tf_colocation_sync_googlenet/1-1-1-1//logs_han0001i_worker:total images/sec: 103.20
tf_colocation_sync_googlenet/2-2-2-1//logs_han0036i_worker:total images/sec: 195.63
tf_colocation_sync_googlenet/3-3-3-1//logs_han0031i_worker:total images/sec: 296.70
tf_colocation_sync_googlenet/4-4-4-1//logs_han0040i_worker:total images/sec: 397.95
tf_colocation_sync_googlenet/5-5-5-1//logs_han0006i_worker:total images/sec: 501.80
tf_colocation_sync_googlenet/6-6-6-1//logs_han0033i_worker:total images/sec: 601.88
tf_colocation_sync_googlenet/7-7-7-1//logs_han0031i_worker:total images/sec: 694.32
tf_colocation_sync_googlenet/8-8-8-1//logs_han0013i_worker:total images/sec: 793.94
tf_colocation_sync_inception3/1-1-1-1//logs_han0001i_worker:total images/sec: 27.95
tf_colocation_sync_inception3/2-2-2-1//logs_han0032i_worker:total images/sec: 57.89
tf_colocation_sync_inception3/3-3-3-1//logs_han0035i_worker:total images/sec: 86.88
tf_colocation_sync_inception3/4-4-4-1//logs_han0036i_worker:total images/sec: 115.63
tf_colocation_sync_inception3/5-5-5-1//logs_han0040i_worker:total images/sec: 145.01
tf_colocation_sync_inception3/6-6-6-1//logs_han0008i_worker:total images/sec: 173.67
tf_colocation_sync_inception3/7-7-7-1//logs_han0031i_worker:total images/sec: 203.46
tf_colocation_sync_inception3/8-8-8-1//logs_han0035i_worker:total images/sec: 230.64
tf_colocation_sync_resnet152/1-1-1-1//logs_han0001i_worker:total images/sec: 14.61
tf_colocation_sync_resnet152/2-2-2-1//logs_han0032i_worker:total images/sec: 28.89
tf_colocation_sync_resnet152/3-3-3-1//logs_han0023i_worker:total images/sec: 44.70
tf_colocation_sync_resnet152/4-4-4-1//logs_han0031i_worker:total images/sec: 58.99
tf_colocation_sync_resnet152/5-5-5-1//logs_han0007i_worker:total images/sec: 73.51
tf_colocation_sync_resnet152/6-6-6-1//logs_han0026i_worker:total images/sec: 85.85
tf_colocation_sync_resnet152/7-7-7-1//logs_han0031i_worker:total images/sec: 102.79
tf_colocation_sync_resnet152/8-8-8-1//logs_han0035i_worker:total images/sec: 117.12
tf_colocation_sync_resnet50/1-1-1-1//logs_han0001i_worker:total images/sec: 44.83
tf_colocation_sync_resnet50/2-2-2-1//logs_han0040i_worker:total images/sec: 90.92
tf_colocation_sync_resnet50/3-3-3-1//logs_han0004i_worker:total images/sec: 138.23
tf_colocation_sync_resnet50/4-4-4-1//logs_han0008i_worker:total images/sec: 185.06
tf_colocation_sync_resnet50/5-5-5-1//logs_han0032i_worker:total images/sec: 233.60
tf_colocation_sync_resnet50/6-6-6-1//logs_han0031i_worker:total images/sec: 276.48
tf_colocation_sync_resnet50/7-7-7-1//logs_han0008i_worker:total images/sec: 323.27
tf_colocation_sync_resnet50/8-8-8-1//logs_han0035i_worker:total images/sec: 367.67
tf_colocation_sync_vgg16/1-1-1-1//logs_han0001i_worker:total images/sec: 7.85
tf_colocation_sync_vgg16/2-2-2-1//logs_han0035i_worker:total images/sec: 16.75
tf_colocation_sync_vgg16/3-3-3-1//logs_han0040i_worker:total images/sec: 23.14
tf_colocation_sync_vgg16/4-4-4-1//logs_han0037i_worker:total images/sec: 27.65
tf_colocation_sync_vgg16/5-5-5-1//logs_han0031i_worker:total images/sec: 32.54
tf_colocation_sync_vgg16/6-6-6-1//logs_han0008i_worker:total images/sec: 37.42
tf_colocation_sync_vgg16/7-7-7-1//logs_han0034i_worker:total images/sec: 39.26
tf_colocation_sync_vgg16/8-8-8-1//logs_han0040i_worker:total images/sec: 40.95";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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