Let's say I have a string: "This is a string-thing". I want to split on both space and hyphen, but keep the separators together with the previous word => ["This ", "is ", "a ", "string-", "thing"]
I'm currently doing this using the following regExp:
string.split(/(?<=[\s-])/g)
This does what is supposed to.. at least in Chrome. As I understand Safari doesn't support lookbehind in regExp which breaks the code. Is there any way to do this without lookbehind?