给定以下字符串变体:
var string = "groups/Da12312a"
var string = "groups/Da12312a/search"
var string = "groups/Da12312a/search/sam"
var string = "groups/3131"
var string = "groups/444/search"
var string = "groups/123asdadsZad/search/sam"
我怎样才能只取回groups/后面的值并以第一个'/'结尾?
所需的输出:
Da12312a
Da12312a
Da12312a
3131
444
123asdadsZad
使用 jQuery 还是 JavaScript?谢谢