Hi sun21170,
Use RegularExpressions.
Refer below sample.
HTML
<asp:Label ID="lblData" runat="server" />
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string str = @"<div>dds \n ss \n xdd</div><pre>sdddsds \n mike \n snippets</pre>";
string result = System.Text.RegularExpressions.Regex.Replace(str, @"<pre>(.*?)</pre>", m =>
{
return m.Groups[1].Value.Replace("\\n", string.Empty);
});
lblData.Text = result;
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim str As String = "<div>dds \n ss \n xdd</div><pre>sdddsds \n mike \n snippets</pre>"
Dim result As String = System.Text.RegularExpressions.Regex.Replace(str, "<pre>(.*?)</pre>",
Function(m) m.Groups(1).Value.Replace("\n", String.Empty))
lblData.Text = result
End Sub
Output
dds \n ss \n xdd
sdddsds mike snippets