// Collection of code snippets by Arne Vajhøj
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now)
using System;
using System.Text.RegularExpressions;
namespace E
{
public class Program
{
public static string Strip1(string s)
{
return Regex.Replace(s, @"<(.|\n)*?>", string.Empty);
}
public static string Strip2(string s)
{
return Regex.Replace(s, "<[^>]*>", "");
}
public static string Strip3(string s)
{
return Regex.Replace(s, "<(?!br)[^>]*>", "", RegexOptions.IgnoreCase);
}
public static void Main(string[] args)
{
String s = "bla bla
foo
bar
";
Console.WriteLine(s);
Console.WriteLine(Strip1(s));
Console.WriteLine(Strip2(s));
Console.WriteLine(Strip3(s));
}
}
}