I would like to split a string based on the following rules:
- if it contains 0 bullets (•), return the whole string
- if it contains 1 or more bullets, return the string up until the bullet, and then a new group starting with each bullet.
Example:
"Python is: • Great language • Better than Java • From 1991"
Should return 4 groups:
["Python is: ", "• Great language ", "• Better than Java ", "• From 1991"]
I tried using this regex:
re.split('[^•](.+?)[•$]')
But since the bullet is a boundary, if it finds one match ending in a bullet, it doesn't see the next string as beginning in one.
How can I solve this?