Quantcast
Channel: SQLServerCentral » Reporting Services » Reporting Services » Latest topics
Viewing all articles
Browse latest Browse all 2791

Regex Expression to remove RTF tags

$
0
0
Hi There,I have a file that I get from pulling out values from a Microsoft Lync 2013 conversation that has RTF formatting tags. An example file would be like:Here is my file:[code="other"] {\rtf1\fbidis\ansi\ansicpg1254\deff0ouicompat\deflang1055{\fonttbl{\f0\fnil\fcharset162 Segoe UI;}{\f1\fnil\fcharset238 Segoe UI;}{\f2\fnil Segoe UI;}} {\colortbl ;\red0\green0\blue0;} {\*\generator Riched20 15.0.4420}{\*\mmathPr\mwrapIndent1440 }\viewkind4\uc1 \pard\cf1\embo\f0\fs20 emaillerini\embo0 \embo al \embo0 \f2\par {\*\lyncflags rtf=1}}[/code]I want to remove RTF tags and and just pull out the text of the conversation. So the result of my function should be:[code="other"] emaillerini al[/code]BTW, I been using Microsoft SQL Server Report Builder for that. I have a expression like below and but it's not working.[code="sql"] =SWITCH(Fields!ContentType.Value = "text/rtf",Code.ConvertRtfToTextRegex(Fields!Body.Value), Fields!ContentType.Value = "text/plain",Fields!Body.Value, Fields!ContentType.Value = "text/html",System.Text.RegularExpressions.Regex.Replace(Fields!Body.Value, "\<[^\>]+\>", ""), Fields!ContentType.Value <> "", Fields!Body.Value )[/code]Thanks & Regards,

Viewing all articles
Browse latest Browse all 2791

Trending Articles