using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"((?<=\()\S+(?=%\))|^\S+(?=\s\[))";
string input = @"0
1991 (38.26%)
1018 (41.52%)
438 (35.12%)
771 (35.16%)
244 (35.72%)
343 (32.48%)
316 (40.51%)
177 (33.84%)
133 (41.18%)
792 (35.92%)
3190 (61.30%)
1426 (58.16%)
803 (64.39%)
1415 (64.52%)
436 (63.84%)
711 (67.33%)
463 (59.36%)
345 (65.97%)
187 (57.89%)
1403 (63.63%)
44.00 [38.00 - 50.00]
43.00 [37.00 - 49.00]
43.00 [37.00 - 49.00]
44.00 [38.00 - 50.00]
44.00 [39.00 - 50.00]
44.00 [38.00 - 50.00]
43.00 [37.00 - 49.00]
45.00 [39.00 - 51.00]
44.00 [37.00 - 50.00]
45.00 [38.00 - 51.00]
";
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