Forum Discussion

TheoM's avatar
TheoM
Helper I
8 years ago

Strip rtf code and html tags from text

I have a text column (in a sql database) that contains a lot of rubbish. I discovered 2 things I want to get rid of:

1. rtf code like this: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} There can be several strings like this in my text (or none at all), the code allways starts with "{" and ends with "}". Sometime the code is nested like in the example I mentioned. Sometimes there is code around the plain text I want to keep.

2. html code, which always starts with a "\" and ends with a " "

 

A DAX formula is probably not the best way to solve the problem. I don't have enough experience with the Query editor or sql queries to solve the problem there.

Does anyone have a suggestion?