private void ThreadFunc()
{
try
{
Stopwatch sw = Stopwatch.StartNew();
// search based on \n for newline
Matches = _Regex.Matches(Regex.Replace(Input, "\r\n", "\n"));
System.Collections.Generic.List<Match> UnneededList = new System.Collections.Generic.List<Match>();
// force matches to actually run
foreach (Match m in Matches)
{
UnneededList.Add(m);
}
if (Replace != null)
Result = _Regex.Replace(Input, Replace);
ExecutionTime = sw.ElapsedMilliseconds;
}
catch (Exception ex)
{
Error = ex;
}
finally
{
if (Error == null || !(Error is ThreadAbortException))
Parent.Invoke(new RegexRunnerFinishedDelegate(Parent.RegexRunnerFinished), this);
}
}