Re: re.split() problem

2005-09-23 Thread Takemura Masayuki
Thanks for your reply. >>> In Re: re.split() problem >>> [Fredrik] = "Fredrik Lundh" wrote Fredrik> >>> s = "foo\nbar\n\nbaz" Fredrik> >>> re.findall("(?s).*\n\n|.+$", s) Fredrik> ['foo\nbar\n\n&#

Re: re.split() problem

2005-09-22 Thread Fredrik Lundh
Masayuki Takemura wrot: > re.split() doesn't work as I intend. it works as it's supposed to work. empty matches are not considered to be valid split points, partially because it doesn't really make sense to split on nothing in most cases, but mostly because doing so will, most likely, result in

re.split() problem

2005-09-22 Thread Masayuki Takemura
Hi all. re.split() doesn't work as I intend. My Python Version is 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32. For example, >>> r = re.compile('^$', re.MULTILINE) >>> r.split('foo\nbar\n\nbaz') ['foo\nbar\n\nbaz'] but I expected ['foo\nbar\n', 'baz']. This proble