using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"EGA-(?:(?!New=).)+(New=[:\d\/ ]+)";
string input = @"structure(list(flight_history_id = c(280604281L, 280316415L,
280315758L, 280316495L, 280303866L, 280303866L, 280271465L, 280271465L,
280271465L, 280271465L), date_time_recorded = structure(c(10L,
4L, 3L, 2L, 7L, 1L, 9L, 8L, 6L, 5L), .Label = c(""2012-11-12 05:50:23.547-08"",
""2012-11-12 15:38:10.099-08"", ""2012-11-12 16:10:06.968-08"", ""2012-11-12 17:25:08.814-08"",
""2012-11-12 17:58:14.268-08"", ""2012-11-13 05:16:41.01-08"", ""2012-11-13 06:51:45.831-08"",
""2012-11-13 07:38:19.593-08"", ""2012-11-13 07:54:22.588-08"", ""2012-11-13 17:55:58.673-08""
), class = ""factor""), event = structure(c(1L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L), .Label = c(""Arrival Estimation"", ""Time Adjustment""
), class = ""factor""), data_updated = structure(c(3L, 8L, 7L,
4L, 2L, 5L, 1L, 10L, 9L, 6L), .Label = c(""AGD- New=11/13/12 10:22, EGA- Old=11/13/12 11:20 New=11/13/12 11:09"",
""AGD- Old=11/13/12 07:40 New=11/13/12 07:38, EGA- Old=11/13/12 10:25 New=11/13/12 10:18"",
""EGA- Based on Distance and Airspeed"", ""EGD- New=11/13/12 06:35, DGATE- New=A1, EGA- New=11/13/12 07:15"",
""EGD- New=11/13/12 07:45, DGATE- New=11, EGA- New=11/13/12 10:25, AGATE- New=A1"",
""EGD- New=11/13/12 08:55, EGA- New=11/13/12 09:45, AGATE- New=A1"",
""EGD- New=11/13/12 19:05, DGATE- New=A7, EGA- New=11/13/12 20:50, AGATE- New=C5"",
""EGD- New=11/13/12 20:20, DGATE- New=A1, EGA- New=11/13/12 21:00"",
""EGD- Old=11/13/12 08:55 New=11/13/12 10:05, EGA- Old=11/13/12 09:45 New=11/13/12 10:55"",
""EGD- Old=11/13/12 10:05 New=11/13/12 10:30, EGA- Old=11/13/12 10:55 New=11/13/12 11:20""
), class = ""factor"")), .Names = c(""flight_history_id"", ""date_time_recorded"",
""event"", ""data_updated""), row.names = c(862L, 5514L, 5527L, 5539L,
5545L, 5558L, 5564L, 5566L, 5570L, 5572L), class = ""data.frame"")";
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