Replace text and more lists

Hello,

I’m looking for a way to replace text as shown in the image. In this case, I want to replace each “REPLACEx” with a CB/CT value. The CB/CT values are in two separate lists, and I also want to get two separate result lists, as shown in the output I wrote.

One important detail is that, for example, REPLACE13 should not be replaced by REPLACE1. Because of this, the “replace text” node doesn’t work properly. I’ve added the file — thanks in advance!

Replace text.gh (12.1 KB)

Replace text_rp0.gh (7.6 KB)

Use Wombat plugin Replace Text (Multiline)

Thanks for your reply, but in this case also the word ‘REPLACE11’ gets replaced with REPLACE1 + “1” right?

With Python, replacing the text fragment takes one line of code.

import re

a = re.sub(pattern, fragment, text)

regex_replace_python.gh (9.5 KB)

Thank you