I have a json file like this:
{
"title": "Pilot",
"image": [
{
"resource": "http://images2.nokk.nocookie.net/__cb20110227141960/notr/images/8/8b/pilot.jpg",
"description": "not yet implemented"
}
],
"content": "<p>The pilot ...</p>"
},
{
"title": "Special Christmas (Part 1)",
"image": [
{
"resource": "http://images1.nat.nocookie.net/__cb20090519172121/obli/images/e/ed/SpecialChristmas.jpg",
"description": "not yet implemented"
}
],
"content": "<p>Last comment...</p>"
}
I need to replace the content from all the resource values in the file, so if a string has this format:
"http://images1.nat.nocookie.net/__cb20090519172121/obli/images/e/ed/SpecialChristmas.jpg"
the result should be:
"../img/SpecialChristmas.jpg"
Could someone tell me how to match that pattern in order to modify the file?
I tried something like this recommendation:
https://stackoverflow.com/a/4128192/521728
but I don't know how to adapt it to my situation.
Thanks in advance!