using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\d*\.\d*)( lb \(\d*\.*\d* kg\))";
string substitution = @"\1";
string input = @"Age Weight Length
0 7.4 lb (3.3 kg) 19.6"" (49.8 cm)
1 21.3 lb (9.6 kg) 29.8"" (75.7 cm)
2 27.5 lb (12.5 kg) 34.2"" (86.8 cm)
3 31.0 lb (14.0 kg) 37.5"" (95.2 cm)
4 36.0 lb (16.3 kg) 40.3"" (102.3 cm)
5 40.5 lb (18.4 kg) 43.0"" (109.2 cm)
6 45.5 lb (20.6 kg) 45.5"" (115.5 cm)
7 50.5 lb (22.9 kg) 48.0"" (121.9 cm)
8 56.5 lb (25.6 kg) 50.4"" (128 cm)
9 63.0 lb (28.6 kg) 52.5"" (133.3 cm)
10 70.5 lb (32 kg) 54.5"" (138.4 cm)
11 78.5 lb (35.6 kg) 56.5"" (143.5 cm)
12 88.0 lb (39.9 kg) 58.7"" (149.1 cm)
13 100.0 lb (45.3 kg) 61.5"" (156.2 cm)
14 112.0 lb (50.8 kg) 64.5"" (163.8 cm)
15 123.5 lb (56.0 kg) 67.0"" (170.1 cm)
16 134.0 lb (60.8 kg) 68.3"" (173.4 cm)
17 142.0 lb (64.4 kg) 69.0"" (175.2 cm)
18 147.5 lb (66.9 kg) 69.2"" (175.7 cm)
19 152.0 lb (68.9 kg) 69.5"" (176.5 cm)
20 155.0 lb (70.3 kg) 69.7"" (177 cm)
";
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