Im searching multiple text files and there are some lines missing which I'm trying to replace it with "NO DATA"
var GetNotes = new Regex(@"(?<=[A-Z0-9/jfc]</B>)([\s\Sa-z]*?[\s\S])(?=<tr><td>|<tr class=disabled>|</table><h4 class|[£])").Matches(set);
foreach (var Notes in GetNotes)
{
String NotesAtLine1 = File.ReadLines(FractionTwoData).ElementAtOrDefault(NotesPositionLine);
string NotesToString = Notes.ToString();
string replacement = Regex.Replace(NotesToString, @"\t|\n|\r", "");
File.AppendAllText(NotesData, NotesAtLine1 + replacement + Environment.NewLine);
NotesPositionLine++;
if (DebugChechBox.Checked == true)
{
Console.WriteLine("Notes are " + replacement);
NotesBox.Text = replacement;
}
}
if it finds my regex it works fine, but how do I get it to do something if it doesn't exist?