I am currently implementing a system and came across the following problem.
We are making a call to a 3rd party supplier that provides a string of contents which is not in JSON format, therefore we are trying to remove content from the string, in order to build a JSON string and serialize it into our own object.
We are trying to remove the part from {"imgCount
to ]",
(just before the "images":
An example of the string is the following:
img_CB("imgCount":31,"imgHash":"[6ede94341e1ba423ccc2d4cfd27b9760]","images":{...});
The issue is that, the imgCount and imgHash may not be in that order. It could be in something like the following:
img_CB("images":{....}, "imgHash":"[6ede94341e1ba423ccc2d4cfd27b9760]", "imgCount":31);
Therefore this makes it quite dynamic and hard to determine where to start "replacing" from.
Would anyone help to possibly build a regex expression to replace/remove the imgHash and imgCount tags with their values please?
Thanks