[issue21551] Behavior of word boundaries in regexes unexpected
R. David Murray
report at bugs.python.org
Wed May 21 18:02:43 CEST 2014
R. David Murray added the comment:
"Note that split will never split a string on an empty pattern match"
You can get what you want this way:
>>> re.split(r'(\w*)', 'a funky string')
['', 'a', ' ', 'funky', ' ', 'string', '']
Or use r'(\W*)' if you don't actually want the leading and training empty strings.
----------
nosy: +r.david.murray
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21551>
_______________________________________
More information about the Python-bugs-list
mailing list