Removing certain parts from a text

Hello Make Team,
I built an automation to add my emails into our notion account. Now i would love to remove a certain Email Signatur that repeats itself in various emails. In Python i would do it like this:

def remove_repeating_paragraph(text, paragraph):

Split the text into paragraphs (assuming paragraphs are separated by blank lines).

paragraphs = text.split(β€˜\n\n’)

Iterate through the paragraphs and remove the specified paragraph if found.

new_paragraphs = [p for p in paragraphs if p != paragraph]

Rejoin the remaining paragraphs to create the edited text.

edited_text = β€˜\n\n’.join(new_paragraphs)

return edited_text

Sample text

text = β€œβ€"This is a sample text.

This is the paragraph to be removed.

Another paragraph here.

This is the paragraph to be removed.

Yet another paragraph at the end.β€œβ€"

The paragraph to be removed

to_remove_paragraph = β€œThis is the paragraph to be removed.”

edited_text = remove_repeating_paragraph(text, to_remove_paragraph)

Is there any way to remove a certain text from the output of a text praser that repeats itself?

Thank you so much for any help in advance.


There are a few ways to handle this, but to start, you could try using replace() function on the text. Use {{emptystring}} as the replacement value.


if you can do it in Python, why not use this instead of rebuilding in a complicated way in make com
You can use or host the script yourself on call it via the http module.

1 Like