Converting HTML

Is there a formula I can use to replace, say, " with " ? I find myself often having to go in and do this manually. Thanks in advance for your suggestions! :slight_smile:

The items you’re replacing didn’t come through. Here’s what I see:

Are you trying to replace quotes? Both of those look the same. Can you describe what you want to do in greater detail?

Attempt number three:

I want &-q-u-o-t-; replaced by "

Maybe spelling it out like a swear word will work?

Success! :smiley:

This is fairly easy using the SUBSTITUTE() function:

SUBSTITUTE({HTML Field}, """, '"')

FWIW, what I just did there is a great way to force the forum to honor whatever you type: turn it into preformatted text using the </> item in the editor toolbar. For multiple lines of text, wrap them in pairs of graves triplets (the grave is this: ` — it shares the key with the tilde ~ symbol). With that, this:

Testing 123


Testing 123

Thanks! That formula worked for the quotation mark, but not for additional adjustments that needed to be made. Here’s how I tweaked it to take on one of those additional adjustments:

Attempt Number 1:

SUBSTITUTE({Excerpt}, '&quot;', '"') & SUBSTITUTE({Excerpt}, '--', '—')

Attempt Number 2

SUBSTITUTE({Excerpt}, '&quot;', '"', SUBSTITUTE({Excerpt}, '--', '—'))

The first attempt didn’t make the dashes/bar adjustment, and the second attempt returned an error message. And I always wondered about the preformatted text thing! :slight_smile:

If you want to make multiple changes to some text using several SUBSTITUTE() functions, you’ll need to nest them inside each other. Your second attempt threw an error because you didn’t get the nesting set up correctly. Instead of each SUBSTITUTE() operating on the original content, the outer ones need to operate on the results of the inner ones, like this:

SUBSTITUTE(SUBSTITUTE({Excerpt}, '--', '—'), '&quot;', '"')

Nested functions always work from the inside out. In this case, it first swaps out double-dashes in the original content for an em dash, and then that result is processed to fix the quotes.

1 Like

Perfect! Thanks, Justin! :grinning:

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.