Regex regex = new Regex(@"(^.*text.*$)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
MatchCollection matches = regex.Matches(s);
using (StreamWriter outputFile = new StreamWriter(System.IO.Path.Combine(@"C:\", "mq.txt")))
{
foreach (Match match in matches)
{
outputFile.WriteLine(match.Groups[1]);
}
}
Regex regex = new Regex(@"(^.*text.*$)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
MatchCollection matches = regex.Matches(s);
foreach (Match match in matches)
{
// Write the string array to a new file named "WriteLines.txt".
using (StreamWriter outputFile = new StreamWriter(System.IO.Path.Combine(@"C:\", "mq.txt")))
{
outputFile.WriteLine(match.Groups[1]);
}
}
, cos