我有一个带有HTML代码的字符串.我想删除所有的HTML标签.所以<和>之间的所有字符.
这是我的代码剪辑:
WebClient wClient = new WebClient(); SourceCode = wClient.DownloadString( txtSourceURL.Text ); txtSourceCode.Text = SourceCode; //remove here all between "<" and ">" txtSourceCodeFormatted.Text = SourceCode;
希望有人能帮助我
试试这个:
txtSourceCodeFormatted.Text = Regex.Replace(SourceCode, "<.*?>", string.Empty);
但正如其他人所说,小心处理.