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 ","og"] . Is this RegExp possible? 回答1: Is this what you want? "go good golly gog".split(/(?!^)g(?!$)/) 来源: https://stackoverflow.com/questions/6448461/regexp-split-a-string-by-its-middle-character-matches