cheng wrote: > im sorry, my engilsh is not vell well, That's alright, you could have been french. ;)
> the string not only contain '&' and '|' and it can be anyting > > i just want to split out the "whole word" inside the string Look at the example for split function of re module in the doc [1]. In short: >>> import re >>> s="(word1 & (Word2|woRd3))" >>> re.split("\W+",s) ['', 'word1', 'Word2', 'woRd3', ''] >>> [w.lower() for w in re.split("\W+",s) if w != ''] ['word1', 'word2', 'word3'] >>> [1]http://python.org/doc/lib/node114.html -- http://mail.python.org/mailman/listinfo/python-list