using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"
(\d+)\t(\d+)";
string substitution = @"INSERT INTO loyalty_rule(rule_id_fk, loyalty_id_fk) VALUES ($1, $2);";
string input = @"
6 9
6 10
8 11
9 12
10 13
11 14
12 15
13 16
14 17
15 18
16 19
17 20
18 21
19 22
20 23
5 24
4 25
21 26
22 27
1 28
23 29
24 30
25 31
26 32
27 33
28 34
29 35
30 36
31 37
32 38
33 39
34 40
35 41
36 42
37 43
38 44
39 45
40 46
41 47
42 48
43 49
44 50
45 51
46 52
47 53
48 54
49 55";
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