Skip to main content

As part of a bot, I am copying a string to clipboard that reads something like this:

“(…) mechanisms for the application of proceeds, set-off, payment, calculation, and notification. <span data-id="1d8743a3s628d9hg3248f2673">3</span> This document is (…)”

I want to remove all spans (open and close) and everything between them so the text reads:

“(…) mechanisms for the application of proceeds, set-off, payment, calculation, and notification. This document is (…)”

I want to do this for all spans in the string so it cleans all of it out. I tried using a String - Replace action to replace everything between “<span>” and <”/span” with blank text but it didn’t work. I tried using a regex function to allow a wildcard at the end of “<span>”.

When I paste into Word it seems to do some formatting to remove these spans, but the raw string I get from the necessary Copy to Clipboard has the spans in them.

Not particularly elegant, but it works:

 


Use String: Replace 

Replace string matching following regex with empty string:

 

<spana^>]*>.*?<\/span>

 


Reply