using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"[^[:print:]]\[[^a-zA-Z]*[a-zA-Z]";
string input = @"[BEGIN TYPESCRIPT]
[H[JLinux dcim-mao 4.19.0-20-cloud-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jul 10 08:00:55 2023 from 172.17.0.2
[?2004hroot@dcim-mao:~# cd
[?2004l
[?2004hroot@dcim-mao:~# ls
[?2004l
[?2004hroot@dcim-mao:~# cd /
[?2004l
[?2004hroot@dcim-mao:/# ls
[?2004l
app etc media public srv usr
bin home mnt root supervisor.conf var
boot lib opt run sys
dev lib64 proc sbin tmp
[?2004hroot@dcim-mao:/#
[END TYPESCRIPT]";
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