Filter a list containing numbers and alphabets into two lists one containing numbers and one alphabets

Hi all,

I have the list shown in the picture, it contains “R1” , “Y1”,“B1”,“B2RY3”,“R2”
I want to split this list into two lists, one contains all of the alphabets. It will be like R, Y, B , BRY, R
and the other list will contain the numbers 1,1,1, 23,2
The purpose is to have a list with the alphabets and another list with the numbers

Can anyone help with that?

String.CharacterAtIndex from the Rhythm package can split a string to each character with a sequence based on the string length. Once that is doe you’re into converting strings to numbers and list management.

You can also use regex:

String.FindRegularExpression is from the Clockwork package.

3 Likes

Thanks Jacob,

Almost there but i have a small problem with the last code block
png
How can i solve this?

Try adding DSCore. in front of the List.Clean method.

1 Like

@tony.zekry A slightly untidy approach …

from which version this node

Hi, I don’t have the talent of the author of the package nor of the one using it
you can find the relevant information here
http://ironpython-test.readthedocs.org/en/latest/howto/regex.html
You will need to install DynamoIronPython2.7 ver 2.5.0
and Clockwork

Sincerely
christian.stan

1 Like