Exclude html tags from values
I am trying to exclude HTML tags from the value displayed in ssrs report.
My solution came to: = (new System.Text.RegularExpressions.Regex ("<[^>] *>")). Replace ((new System.Text.RegularExpressions.Regex ("<STYLE>. * </STYLE>")). Wear (Fields! Activitypointer1_description.Value, ")," ")
The problem is that the second expression ("<STYLE>. * </STYLE>" without spaces), which should be executed first, does nothing. The result contains styles from html with no tags attached.
I have no idea.
FROM
0
a source to share
1 answer
You need to add RegexOptions.Singleline because, by default, regexes stop at newlines. Here's an example of a console program you can run to test it:
string decription = @"<b>this is some
text</b><style>and
this is style</style>";
Console.WriteLine(
(new Regex( "<[^>]*>", RegexOptions.IgnoreCase | RegexOptions.Singleline ))
.Replace(
(new Regex( "<STYLE>.*</STYLE>", RegexOptions.IgnoreCase | RegexOptions.Singleline ))
.Replace( decription
, "" )
, "" )
);
0
a source to share