标签: javascript regex split
我想分割一个不是起始或结束字符的字符的所有实例。例如:"go good golly gog".split(RegExp)将转到["go ","ood ","olly ","og"]。
"go good golly gog".split(RegExp)
["go ","ood ","olly ","og"]
这个RegExp可能吗?
答案 0 :(得分:2)
这是你想要的吗?
"go good golly gog".split(/(?!^)g(?!$)/)