我正在尝试将变量c上的内容与变量s匹配并选择匹配但我得到的只是一个黑色括号或重复变量c。
var s = "flowing through a lava occasionally";
var c = "occasionally, sleep, and, oops";
var re = /(?:^|\W)c(\w+)(?!\w)/g, match, matches = [];
while (match = re.exec(s)) {
matches.push(match[3]);
}
console.log(matches);