正则表达json

时间:2016-02-01 17:47:57

标签: json regex

我有json的这一部分: str =

"lien_images":
[
    "http://restaurant-greuze.secretbox.fr/sites/restaurant-greuze.secretbox.fr/files/imagecache/thumbnail_appi_ios/products/bp-greuze-facade-001[1].jpg",
    "http://restaurant-greuze.secretbox.fr/sites/restaurant-greuze.secretbox.fr/files/imagecache/thumbnail_appi_ios/products/bp-greuze-facade-001[0].jpg",
    "http://restaurant-greuze.secretbox.fr/sites/restaurant-greuze.secretbox.fr/files/imagecache/thumbnail_appi_ios/products/bp-greuze-facade-001[2].jpg"
],
"duree_de_validitee": "365"

我试过这个String tab[] = str.split("lien_images\": [\",\\[\\]]+"); 但结果不正确我需要的只是图像的链接 没有引号或逗号。

  

http://restaurant-greuze.secretbox.fr/sites/restaurant-greuze.secretbox.fr/files/imagecache/thumbnail_appi_ios/products/bp-greuze-facade-001[1].jpg

     

http://restaurant-greuze.secretbox.fr/sites/restaurant-greuze.secretbox.fr/files/imagecache/thumbnail_appi_ios/products/bp-greuze-facade-001[0].jpg

     

http://restaurant-greuze.secretbox.fr/sites/restaurant-greuze.secretbox.fr/files/imagecache/thumbnail_appi_ios/products/bp-greuze-facade-001[2].jpg

我希望它清楚。

1 个答案:

答案 0 :(得分:0)

对不起家伙迟到了,我在非洲所以我们遇到了互联网问题 这是我的解决方案,谢谢。

$(#tabID).focus(function () {
    window.location.reload(true);
});

结果只是图像的链接,对于MyString,它是一个处理String的类。