George Sakkis wrote: > If you don't want any null strings at the beginning or the end, an > equivalent regexp is: > >>>> whitespaceSplitter_2 = re.compile("\w+|\s+") >>>> whitespaceSplitter_2.findall("1 2 3 \t\n5") > ['1', ' ', '2', ' ', '3', ' \t\n', '5'] >>>> whitespaceSplitter_2.findall(" 1 2 3 \t\n5 ") > [' ', '1', ' ', '2', ' ', '3', ' \t\n', '5', ' ']
Perhaps you may want to use "\s+|\S+" if you have non-alphanumeric characters in the string. Reinhold -- http://mail.python.org/mailman/listinfo/python-list