• help with regex

hi all,

I need your help with a regex I'd like to use for a little application I'm working on for training.

The application must get a string as input. The string is composed by various alphanumeric words separated by commas, dots or eventually whitespace like the following:

"OD1323,OB1242 TH32; OF2321"

The application must get the string and output it sorted, with terms separated by commas or other symbols chosen by the user.

I thought that the best way to accomplish that is by using REGEX, because I don't want to force the user by input the data with a specific schema; moreover, the words could be different in format and size.

this is what I'v done till now:

import re stringa = "OD1323,OB1242 TH32; OF2321" result = re.findall(r'\b\w*\b',stringa) print result ['OD1323', '', 'OB1242', '', 'TH32', '', 'OF2321', '']

it works but with undesired '' values at positions 1,3,5,7 of the list.

How can I get rid of these values? is there a way with a regex? I have tried with a recursive list.remove('') but without success.

any idea?

thanks all!