I'm attempting to separate a string like the one below into an array of individual elements, for instance:
var str = "(someword,bbb)"
The resulting array should look like this:
var arr = ["(", "someword", ",", "bbb", ")"]
I've experimented with using split and regex, but it seems to strip away the punctuation marks that I actually want to retain. Is there a way to accomplish this?
Thank you in advance
Splitting with a punctuation-based regex pattern results in the elimination of punctuation marks.