RegExp split a string by its middle character matches
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 ","o开发者_开发技巧g"]
.
Is this RegExp possible?
Is this what you want?
"go good golly gog".split(/(?!^)g(?!$)/)
精彩评论