Steve Holden wrote: > robert wrote: > [...] >> but its also wrong regarding partial last lines. >> >> re.split obviously doesn't understand \A \Z ^ $ and also \b etc. empty >> matches. >> > [...] > Or perhaps you don't understand re? > > It's a tricky thing to start playing with. Look up re.MULTILINE ans > re.DOTALL. >
I tried "all" variations with (?m) (?s) also, and other things. Yet it appeared to me so far, that its not the problem with the line modes - none of empty matching works with split. A basic case: >>> re.split(r'\b','ab cwoe fds. fi foiewj') ['ab cwoe fds. fi foiewj'] He wants at least "something": >>> re.split(r'\b.','ab cwoe fds. fi foiewj') ['', 'b', '', 'woe', '', 'ds', ' ', 'i', ' ', 'oiewj'] While .findXX and .searchXXX are "all-seeing" : >>> re.findall(r'\b','ab cwoe fds. fi foiewj') ['', '', '', '', '', '', '', '', '', ''] Robert -- http://mail.python.org/mailman/listinfo/python-list