// regexreplace.cs
using System;
using System.Net;
using System.Text.RegularExpressions;
class RegexReplace {
static void Main() {
// @ITのトップページを取得
WebClient wc = new WebClient();
string html = wc.DownloadString("http://www.atmarkit.co.jp/");
// や
Regex re1 = new Regex("<(no)?script.*?script>",
RegexOptions.IgnoreCase | RegexOptions.Singleline);
// すべてのタグ
Regex re2 = new Regex("<.*?>", RegexOptions.Singleline);
html = re1.Replace(html, "");
html = re2.Replace(html, "");
Console.WriteLine(html);
}
}
// コンパイル方法:csc regexreplace.cs