using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(#EXTM3U\s+|#EXTINF:\d+,|(.*\.\w{3,4}).*\s+)";
string substitution = @"";
string input = @"#EXTM3U
#EXTINF:419,Alice in Chains - Rotten Apple
http://192.168.101.22:80/movies/9975.mkv
#EXTINF:260,Alice in Chains - Nutshell
http://192.168.101.22:80/movies/1254.mkv
#EXTINF:255,Alice in Chains - I Stay Away
http://192.168.101.22:80/movies/1254.mkv
#EXTINF:256,Alice in Chains - No Excuses
Alice in Chains_Jar of Flies_04_No Excuses.mp3
#EXTINF:157,Alice in Chains - Whale And Wasp
Alice in Chains_Jar of Flies_05_Whale And Wasp.mp3
#EXTINF:263,Alice in Chains - Don't Follow
Alice in Chains_Jar of Flies_06_Don't Follow.mp3
#EXTINF:245,Alice in Chains - Swing On This
Alice in Chains_Jar of Flies_07_Swing On This.mp3
";
Regex regex = new Regex(pattern);
string result = regex.Replace(input, substitution);
}
}
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