You are viewing limited content. For full access, please sign in.

Question

Question

Regex to remove HTML Tags?

asked on November 29, 2023

I'd like to use the Token Editor in Workflow to remove HTML tags from a Rich Text field I'm bringing in from Forms.

Does anyone have a regex that will accomplish this? Google returns sample code for accomplishing this in JS, but we're working in the v11 Modern Designer, and the JS code won't work in the Token Editor in Workflow.

Use case:
Since the v11 Modern Designer won't allow us to use JS to make multi-line fields auto-grow, we've been using Rich Text fields (that auto-grow automatically) instead. We sometimes use CSS to hide the toolbar so it just looks like a multi-line. This has worked well, but when we try to pull the field values into a report, it carries in all of the HTML formatting tags. I was hoping to use Workflow to flatten the fields and strip these out. Regex seemed like the best bet, but if anyone has another solution, that would be great, too!

 

2 0

Answer

SELECTED ANSWER
replied on November 29, 2023

Use "plaintext" to format the token and it will strip all formatting.

5 0
replied on November 29, 2023

That works perfectly and is exactly what I needed.

Thank you so much!!

0 0
replied on June 25

I tried using the plaintext format on a rich text field and found that at the end if there was an empty space or if there were any special characters the html code for those still appeared. Below is an example of what was written to SQL with the plaintext formatting.

& was an '&' and the &nbsp were just spaces. Is there a way to get rid of those?

0 0
replied on June 26

"plaintext" formatting only works on rich-text field values from Forms. If you go through SQL before the value makes it to Workflow, then it's just text and can't be formatted anymore.

0 0
replied on June 26

It is from Forms to Workflow. I'm using a Laserfiche Form that has the richtext field filled out by the end user. I then use Workflow to take that value from Forms and use "plaintext" to format it before it writes to SQL. After the Workflow runs and the data has been added to SQL I check the table and see the result in the screenshot I provided.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.