I modified it so that all splitting characters are applied to each ine of text - your original post let presume that there was one character associated with each string.
Sorry for my late reply, I think this is possibly the solution I am looking for.
Unfortunately I am not an Python expert.
Would it be possible to write it in an GH - Python component, with 2 input variabels:
x = input text which has to be ‘split’
y = all ‘splitting’ characters at which the text has to be split?
so just like the component below, with the difference that the 'splitting characters should still be present?
import re
splitters = "".join(y)
pattern = r"(?=[{" + splitters + r"}])|(?<=[" + splitters + r"]/g)"
a = []
for text in x:
a.append(re.split(pattern,text))
I couldn’t get this to work in a GhPython Script component using regular expression with lookahead(?=…) or lookbehind(?<=…) assertions (these work fine in a C# component).
I was able to get the results @GH-KN wanted with a GhPython Script component, but it took some extra code.