New submission from Dave Abrahams: This session demonstrates. See especially the very last expression evaluated
>>> s='''this is the end s='''this is the end ... your only friend your only friend ... the end''' the end''' >>> re.split('^', s, re.MULTILINE) re.split('^', s, re.MULTILINE) ['this is the end\nyour only friend\nthe end'] >>> re.split('t', s, re.MULTILINE) re.split('t', s, re.MULTILINE) ['', 'his is ', 'he end\nyour only friend\n', 'he end'] >>> re.split('\n', s, re.MULTILINE) re.split('\n', s, re.MULTILINE) ['this is the end', 'your only friend', 'the end'] >>> re.split('(?<=\n)', s, re.MULTILINE) re.split('(?<=\n)', s, re.MULTILINE) ['this is the end\nyour only friend\nthe end'] >>> re.split('^y', s, re.MULTILINE) re.split('^y', s, re.MULTILINE) ['this is the end\nyour only friend\nthe end'] >>> re.split('$', s, re.MULTILINE) re.split('$', s, re.MULTILINE) ['this is the end\nyour only friend\nthe end'] >>> re.split('$\n', s, re.MULTILINE) re.split('$\n', s, re.MULTILINE) ['this is the end\nyour only friend\nthe end'] >>> re.split('\n', s, re.MULTILINE) re.split('\n', s, re.MULTILINE) ['this is the end', 'your only friend', 'the end'] >>> re.split('^t', s, re.MULTILINE) re.split('^t', s, re.MULTILINE) ['', 'his is the end\nyour only friend\nthe end'] >>> re.split('^t', s) re.split('^t', s) ['', 'his is the end\nyour only friend\nthe end'] >>> ---------- components: Regular Expressions messages: 167224 nosy: dabrahams, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.split doesn't respect MULTILINE type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15536> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com