当前位置: 主页 > js >

js替换数组中所有需要替换的字段

2020-06-23  |  来源:前端入门建站教程  |  作者:建站小白

下面前端入门建站教程为大家介绍一下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 文章,请继续关注前端入门建站教程。

最新文章

猜你喜欢