In python I can do:
import re
re.split('(o)', 'hello world')
and get:
['hell', 'o', ' w', 'o', 'rld']
With crystal:
"hello world".split(/(o)/)
I get:
["hell", " w", "rld"]
But I want to keep the matches in the array like in the python example. Is it possible?
This just got added, see this issue.
Until that lands in a release you can trick with lookaround expressions: