In order to replace all instances within {}
with the corresponding data from a JSON array, I need to use a regex pattern that is case-sensitive.
The number of placeholders enclosed in {}
s may vary depending on the page.
s ="<address><div>{Name}</div><div>{Address1}</div><div>{Address2}</div><div>{ZipCode} {City}</div><div>{State}</div><div>{Country}</div><div>{ContactName}</div></address>"
"DeliveryAddress":
{
"Id":5637169131,
"Name":"some name",
"Name2":null,
"Address":"Somewhere street 12",
"Address2":null,
"City":"Heven",
"ZipCode":"1111",
"State":"FL",
"Country":"US",
"VatNo":null,
"ContactRecId":"Receiving Department",
"ContactName":null,
"ContactPhone":null,
"ContactEmail":null,
"DefaultShopDeliveryAddress":false,
"DefaultServiceDeliveryAddress":false,
"IsOneTime":false,
"CaptureId":"00000000-0000-0000-0000-000000000000"
},
Once completed, the matching elements in my JSON array should replace the corresponding {tag} placeholders.
For example:
<address><div>some name</div><div>Somewhere street 12</div><div></div><div>1111 Heaven</div><div>FL</div><div>US</div><div></div></address>