如何使用Javascript中的正则表达式在匹配中查找匹配?

如何使用Javascript中的正则表达式在匹配中查找匹配?,javascript,regex,Javascript,Regex,如何在火柴中找到火柴 使用以下字符串 @function("something") @anotherFunction("moreStuff" "andMore") "evenMore" 我正在尝试用引号和函数名来捕获这些内容。我期待的结果是: 匹配1 Group 1: function Group 2: something Group 3: undefined 第二场比赛 Group 1: anotherFunction Group 2: moreStuff andMore Group 3:

如何在火柴中找到火柴

使用以下字符串

@function("something") @anotherFunction("moreStuff" "andMore") "evenMore"
我正在尝试用引号和函数名来捕获这些内容。我期待的结果是:

匹配1

Group 1: function
Group 2: something
Group 3: undefined
第二场比赛

Group 1: anotherFunction
Group 2: moreStuff andMore
Group 3: undefined
第三场比赛

Group 1: undefined
Group 2: undefined
Group 3: evenMore
我可以使用下面的表达式将所有内容都用引号括起来,但我不确定在查找函数中存在的匹配项时如何捕获正确的组

\"([^\"]*)\" *


顺便说一句,我不确定什么是正确的解释方法。我已经阅读了正则表达式的相关内容,但找不到能够解决此问题的内容。你可以试试这个。你可以去掉你的结果中的“thoughWhat's the regex(和代码)”你曾经获得过这三个匹配项?我一直无法获得这些匹配项,我只是这样写来帮助解释我所追求的。我所能做的就是,但它并没有达到我想要的效果。谢谢@vks,我考虑过这样做,将字符串拆分成一个数组,然后在arr中的每个字符串上运行另一个正则表达式嗯。