转自 https://segmentfault.com/q/1010000007144114/a-1020000007144741
取键
'{"A":"5","B":"4","C":"3","D":"2"}'.match(/"w+":/g).map(function(el){return el.slice(1,-2)}) ["A", "B", "C", "D"]
取值
'{"A":"5","B":"4","C":"3","D":"2"}'.replace(/(?:"[^"]+":)|["{}]/g,'').split(',')
["5", "4", "3", "2"]
str = '{"A":"5","B":"4","C":"3","D":"2"}'; str.split(/(?:^{|",)"[^"]+":"|"}$/g).slice(1,-1) ["5", "4", "3", "2"]
str.split(/[{"][^:]+:"|"}/g).slice(1,-1)
["5", "4", "3", "2"]