How can I split by word boundary in a regex engine that doesn't support it?
python's re can match on \b but doesn't seem to support splitting on it. I seem to recall dealing with other regex engines that had the same limitation.
example input:
"hello, foo"
expected output:
['hello', ', ', 'foo']
actual python output:
>>> re.compile(r'\b').split('hello, foo')
['hello, foo']
(\W+) can give you the expected output:
>>> re.compile(r'(\W+)').split('hello, foo')
['hello', ', ', 'foo']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With