Splitting a string
Nico Grubert
nicogrubert at gmail.com
Tue Feb 14 07:21:27 EST 2006
> re.split("(?i)\s*(and not|and|or)\s*", s)
Thanks, Frederik for the step by step howto! And also thanks to you, Dylan.
re.split("(?i)\s*(and not|and|or)\s*", s) is almost right.
I changed it to:
words = re.split("(?i)\s*( and not | and | or )\s*", s)
in order to handle words containing "or" or "and".
s = 'More, J. or Black and Mand, R.' works now, too.
Thanks!
More information about the Python-list
mailing list