我不知道如何从以下示例中提取多个匹配项:
这段代码:
/prefix-(\w+)/g.exec('prefix-firstname prefix-lastname');
返回:
["prefix-firstname", "firstname"]
我如何让它返回:
[
["prefix-firstname", "firstname"],
["prefix-lastname", "lastname"]
]
或者
["prefix-firstname", "firstname", "prefix-lastname", "lastname"]