Simon Forman wrote: > def splitup(s): > return re.findall(''' > \S*\( [^\)]* \)\S* | > \S*\[ [^\]]* \]\S* | > \S+ > ''', s, re.VERBOSE)
Yours is the same as Tim's, it can't handle a word with two or more brackets pairs, too. I tried to change the "\S*\([^\)]*\)\S*" part to "(\S|\([^\)]*\))*", but it turns out to a mess. -- http://mail.python.org/mailman/listinfo/python-list