Split text - based on multiple successive Letters

Challenge,
There is a list with text items.
I would like to split (and only split) at the location where ‘CX’ are directly behind each other.
So not at only the ‘C’ or ‘X’. I tested (CX){CX}‘CX’ but didn’t work.

Probably quite easy but I can find it.2020-04-11 split text based on multiple letters.gh (6.7 KB)

Any suggestions?

thank you :slight_smile:

Try with Python

2 Likes

Perfect, thanks! :slight_smile:

1 Like

Hi,
Thank you once again :).
But I just came to the concluion there is still 1 challenge to go:
Because I would like to split the items on ‘multiple’ character combinations as shown below.
Unfortunately it is only testing the first character combination to the first item , and the second combi to the second item, instead of testing all the items against the 3 possible chracter comninations.

The same is happening for the HS_Kim solution :slight_smile:

2020-04-11 split text based on multiple letters_re_RE.gh (9 KB)

Any suggestions?

Thanks again!

This is different

txt.gh (5.2 KB)

3 Likes

Hello,
More or less I have a similar problem - seems fairly simple problem, but I can not get to the bottom of it:
I have a huge .txt file with multiple thousands of data rows (both numbers and letters). The data is repeated in cycles of different lengths. I want to divide the data into branches based on first line of each cycle.! What could be the solution?

this works but looks a bit painful… there might be better solutions


PartitionList_Re.gh (12.7 KB)

text.gh (10.3 KB) At least share a text file

Thank you guys. Both suggestions were very helpful!

Hello,

i have a similar problem, i want to delte the x2, x3,x4,x5, x2.5. I need one list with the first values (diameter) and a second list with the second values (thickness). How can i seperate the values ?

Like this?

1 Like