rateltalk

请教一个获取指定数据的正则表达式,类似提取 img url

  •  
  •   rateltalk · Aug 3, 2020 · 2168 views
    This topic created in 2136 days ago, the information mentioned may be changed or developed.

    待处理字符串:a:12+ b:0 a:11+ b:459

    每一对( a:12+ b:0 )之间使用换行符分隔,想提取的数据为:

    {
        12: 0,
        11: 459
    }
    

    目前使用这个无法获取到:'/(?<=a:)(d+).*?(?<=b:)(d+)/'

    1 replies    2020-08-03 11:10:18 +08:00
    netnr
        1
    netnr  
       Aug 3, 2020
    `a:12+ b:0
    a:11+ b:459`.replace(/\w+:\d+/g, function (k) { console.log(k) })
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4013 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 00:50 · PVG 08:50 · LAX 17:50 · JFK 20:50
    ♥ Do have faith in what you're doing.