这是JS文件中的数据:
[{\"value\":16633,\"name\":\"fdgdfgdf@joindiaspora.com\"},{\"value\":16910,\"name\":\"jamesw@wk3.org\"},{\"value\":16911,\"name\":\"sdasfasf@joindiaspora.com\"}]" ),
我想把它输出到一个二维数组中,比如:
值名称,
16633 fdgdfgdf@joindiaspora.com,
16910 jamesw@wk3.org,
16911 sdasfasf@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>↵"]