I'd like to split all the instances of a character that aren't the starting or ending character. For example: "go good golly gog".split(RegExp)
would go to ["go ","ood ","olly ","og"]
.
Is this RegExp possible?
I'd like to split all the instances of a character that aren't the starting or ending character. For example: "go good golly gog".split(RegExp)
would go to ["go ","ood ","olly ","og"]
.
Is this RegExp possible?
Is this what you want?
"go good golly gog".split(/(?!^)g(?!$)/)