下面前端入门建站教程为大家介绍一下js替换数组中所有需要替换的字段
var arr=[
{
"ps": "\u672c\u673a",
"sid": 27
},
{
"ps": "other_http://192.168.0.9_33333",
"sid": 30
},
{
"ps": "\u5916\u7f51\u4e91\u63a7",
"sid": 32
},
{
"ps": "other_http://212.64.25.103:8888_212.64.25.103",
"sid": 33
},
{
"ps": "com_http://212.64.25.103:8888_212.64.25.103",
"sid": 49
},
{
"ps": "other_http://192.168.1.248:8888_192.168.1.248",
"sid": 54
}
]
console.log(JSON.parse(JSON.stringify(arr).replace(/(other_http|pub_http|com_http|sec_http)[^_]*_/gi,'')))
上面是“js替换数组中所有需要替换的字段”的全面内容,想了解更多关于 js 文章,请继续关注前端入门建站教程。