This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月02日 14:41 by dabrahams, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg167224 - (view) | Author: Dave Abrahams (dabrahams) | Date: 2012年08月02日 14:41 | |
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']
>>>
|
|||
| msg167241 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年08月02日 17:06 | |
Same as for issue 15537. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:33 | admin | set | github: 59741 |
| 2012年08月04日 21:07:14 | r.david.murray | set | status: open -> closed superseder: MULTILINE confuses re.split resolution: duplicate stage: resolved |
| 2012年08月02日 17:06:50 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg167241 |
| 2012年08月02日 14:41:18 | dabrahams | create | |