Find and replace html text

Hello, I have this html text in an email template. Does anyone know how to find and replace the below text with nothing?




→ Here is a picture of the html code. When i paste in the code this window automatically converts it

If MyString contains the string you’ve highlighted, and MyText contains all of your html text, you can replace MyString with nothing by assigning a String variable to MyText.Replace(MyString, String.Empty).

Yeah i tried that actually. The issue is, when i paste all that html code in the find replace function, there are line breaks and “” that mess it up.

In that case, for each line break, put “\n” in the variable for MyString. If that doesn’t work, use System.Text.RegularExpressions.Regex.Replace(MyText, MyString, String.Empty) with \n where newlines occur.

So how do I incorporate the “/n” into that above code? Say for the first line, it ends with mso-bookmark:

Would I just put mso-bookmark: \n ?

My actual html code does not have \n. So would it find the text if i put in the \n?

Also, what about parts that say “Arial”? They are in quotes. This is also throwing off my code

Yes, anywhere a new line is about to start, put \n. Quotes can be escaped by typing the quotes twice. For example, if I wanted to replace " in my text, the string would be """" for MyString. This represents only one double-quote character ". So in your case "Arial" would be changed to ""Arial"".

let me give it a try!

Its not working. I think its searching for the /n in the code as well. Should the /n not be in the “”?

The \n should not be represented as "\n", but rather inserted in the code. For instance, "This is a sentence.\nThis sentence is on the next line.".

Yeah it does not seem to work

You could alternatively replace every line with String.Empty using an array of strings. Or if you’re not comfortable with using an array, you can use multiple variables assigned to each line you want to remove.