string split without consumption

robert no-spam at not-existing.invalid
Sat Feb 2 07:22:29 EST 2008


this didn't work elegantly as expected:

 >>> ss
'owi\nweoifj\nfheu\n'
 >>> re.split(r'\A',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'\Z',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'$',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?s)$',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?m)(?s)$',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?m)$',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?m)\Z',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?m)\A',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?s)\A',ss)
['owi\nweoifj\nfheu\n']
 >>> re.split(r'(?s)(?m)\A',ss)
['owi\nweoifj\nfheu\n']
 >>>


how to do?


Robert



More information about the Python-list mailing list