如何使用Regex访问此数据

如何使用Regex访问此数据,regex,diaspora,Regex,Diaspora,这是JS文件中的数据: [{\"value\":16633,\"name\":\"fdgdfgdf@joindiaspora.com\"},{\"value\":16910,\"name\":\"jamesw@wk3.org\"},{\"value\":16911,\"name\":\"sdasfasf@joindiaspora.com\"}]" ), 我想以2d数组的形式输出它,比如: 值名称 16633fdgdfgdf@joindiaspora.com, 16910jamesw@w

这是JS文件中的数据:

    [{\"value\":16633,\"name\":\"fdgdfgdf@joindiaspora.com\"},{\"value\":16910,\"name\":\"jamesw@wk3.org\"},{\"value\":16911,\"name\":\"sdasfasf@joindiaspora.com\"}]" ),
我想以2d数组的形式输出它,比如:

值名称

16633fdgdfgdf@joindiaspora.com,

16910jamesw@wk3.org,

16911sdasfasf@joindiaspora.com

以下是我目前的代码:

$.ajax
({  
    async: false,
    type: 'GET',
    url: 'https://wk3.org/conversations/new',
    success: function(data) 
    {
        var matches;
        var Ragex = /\\"value\\":\\"(.*)\\",\\"name\\":\\"(.*)\\"},/g           //need to sort out the REGEX so it goes through each name and ID seeing if it equals ID
        while ((matches = Ragex.exec(data)) !== null)
        {
            console.log(matches);
        }
    }

});
哪些产出:

["\"value\":\"16633\",\"name\":\"fdgdfgdf@joindiaspora.com\"},…"},{\"value\":\"16910\",\"name\":\"jamesw@wk3.org\"},", "16633\",\"name\":\"fdgdfgdf@joindiaspora.com\"},{\"value\":\…"name\":\"sdasfasf@joindiaspora.com\"},{\"value\":\"16910", "jamesw@wk3.org", index: 92, input: "<script>↵  //<![CDATA[↵    $(document).ready(funct…it" value="Send" />↵</div>↵</form>↵</div>↵</div>↵"]

[“值”:“16633\,“名称”:”fdgdfgdf@joindiaspora.com\“},…”},{\'value\':\'16910\',\'name\':\”jamesw@wk3.org\“},”,“16633\”,“名称”:”fdgdfgdf@joindiaspora.com\},{\“value\:\…“name\:\”sdasfasf@joindiaspora.com\},{“值”:“16910”jamesw@wk3.org,索引:92,输入:↵  // 您希望在
\”:\“?\”
中捕获?对吗

我对散居国外的人并不熟悉


在python中,模式
(\“:\”(\”)(\”
应该是这样的

您能告诉我们您从web服务中得到的结果吗?在您操作它之前,也就是说。您想让我截屏控制台日志吗?将两次出现的
(.*)
更改为
([^”]*)
,只要你没有在值中转义双引号,那应该符合你的要求。谢谢@TomRegner这正是我要找的!它说它不能删除,因为它有答案,我已经把我的答案放在底部了。我真的不明白你的意思,我对REGEX不熟悉,我正努力按照上面的要求输出它。我请注意捕获所需内容的模式(python)。然后,您必须编写散居地代码以输出结果
$.ajax
({  
    async: false,
    type: 'GET',
    url: 'https://wk3.org/conversations/new',
    success: function(data) 
    {
        var matches;
        var name;
        var regex = /{\\"value\\":\\"([^"]*)\\",\\"name\\":\\"([^"]*)\\"}/g         //need to sort out the REGEX so it goes through each name and ID seeing if it equals ID
        while ((matches = regex.exec(data)) !== null)
        {
            console.log(matches);
            var name = matches[2];
            if(name == ID)
            {
                result = matches[1];
            }
            else
            {
                console.log("FAIL");
                //this sends a message to me only
                //need to add error trapping saying recipient cannot be found!
            }
        }
    }

});