HTML

SSRS 2005
I have a text field that contains html.
I need to strip it out

I found this code, but it dosent work

=System.Text.RegularExpressions.Regex.Replace(Fields!MyFieldName.Value,@"<(.|\n)*?>",string.Empty)

the error I get is
"The Value expression for the textbox text contains error [BC300037] Character is not valid."

tia
fundsfAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James MurrellProduct SpecialistCommented:
0
jgvCommented:
The error is because of the @ symbol outside of the double quotes. You also need to enclose the characters being stripped out with square brackets. The corrected expression would look like this:
=System.Text.RegularExpressions.Regex.Replace(Fields!MyFieldName.Value,"[<(.|\n)*?>]",string.Empty)
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

fundsfAuthor Commented:
jgv:
This is the error that I get when I add the expression
"Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specific set scope."

fyi it points to Replace as an issue in the editor
0
jgvCommented:
Don't worry about the syntax check on Replace; it does work. Your other problem is related to referencing a field that is not available ("out of scope"). Do you have the expression in a Table?
0
fundsfAuthor Commented:
Yes, Its in a table.
A group header
0
jgvCommented:
Is the field that you are referencing in the expression part of the dataset that the Table is linked to?

Did you create the table group using the same field being referenced in the expression or would the field in the expression be part of the group details?
0
fundsfAuthor Commented:
jgv:

Is the field that you are referencing in the expression part of the dataset that the Table is linked to?
--Yes

Did you create the table group using the same field being referenced in the expression or would the field in the expression be part of the group details?
---The Group that I created is not based on the field I need the HTML stripped

0
jgvCommented:
It's a bit difficult to troubeshoot this without seeing the report and how you have it setup.

Try changing the expression to this and seeing if it helps:
=System.Text.RegularExpressions.Regex.Replace(First(Fields!MyFieldName.Value),"[<(.|\n)*?>]",string.Empty)
0
jgvCommented:
This was still in the troubleshooting phase so there's no specific answer posted. The last suggestion I gave may have worked, but without any feedback there's no way to know. If fundsf does not follow up then I'd say split the points between cs97jjm3 and myself for making the attempt; final decision is yours.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB Reporting Tools

From novice to tech pro — start learning today.