Below is the sample code. The string contains HTML tags like below:
HTML Code:
.CS Code
The output will come as:
"Hello World Br Should not come.But what about this? Will this | will come? )"
HTML Code:
.CS Code
protected void btnTest_Click(object sender, EventArgs e)
{
string strHtml = "
Br Should not come.But what about this? Will this | will come? ) ";
Regex regex = new Regex("<[^>]*>");
string strWithOutHTMLTag = regex.Replace(strHtml, "");
lblResult.Text = strWithOutHTMLTag;
}
{
string strHtml = "
Hello World
Br Should not come.But what about this? Will this | will come? ) ";
Regex regex = new Regex("<[^>]*>");
string strWithOutHTMLTag = regex.Replace(strHtml, "");
lblResult.Text = strWithOutHTMLTag;
}
The output will come as:
"Hello World Br Should not come.But what about this? Will this | will come? )"
No comments:
Post a Comment