编辑代码

package main  
  
import (  
    "fmt"  
    "regexp"  
)  
  
func main() {  
    jsonString := `"volume": 0,  
                    "fps": 30,  
                    "audioCodec": "aac",  
                    "rotate": 0,  
                    "backupUrls": ["http://sns-video-bd.xhscdn.com/stream/110/258/01e476bba6be60d601037303886fce03e2_258.mp4", "http://sns-video-qc.xhscdn.com/stream/110/258/01e476bba6be60d601037303886fce03e2_258.mp4?sign=d1ce5386d4dee0f6ee8e48333fc93fe1&t=649711d4", "http://sns-video-al.xhscdn.com/stream/110/258/01e476bba6be60d601037303886fce03e2_258.mp4"],  
                    "avgBitrate": 1545510,  
                    "psnr": 0,  
                    "format": "mp4"`  
  
    // 定义正则表达式  
    pattern := `"backupUrls":\s?\[\.*\]`
    re := regexp.MustCompile(pattern)

    // 提取匹配结果  
    matches := re.FindAllStringSubmatch(jsonString, -1)  
    if matches == nil {  
        fmt.Println("No match found.")  
        return  
    }  
  
    // 输出匹配结果  
    for _, match := range matches {  
        fmt.Println(match[1])  
    }  
}