Tim Chase wrote:
> Ah...the picture is becoming a little more clear:
>
>  >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+')
>  >>> r.findall(s)
> ['(a c)b(c d)', 'e']
>
> It also works on my original test data, and is a cleaner regexp
> than the original.
>
> The clearer the problem, the clearer the answer. :)

Ah, it's exactly what I want!  I thought the left and right sides of
"|" are equal, but it is not true.  I think I must sleep right now,
lacking of sleep makes me a dull :-p.  Thank you and Simon for your
kindly help!

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to