Extract and Create Property in JSON file with RegEx -
i have following json file. dotted across file following:
"properties": { "name": "darlington", "description": "<br><br><br> <table border=\"1\" padding=\"0\"> <tr><td>ccgcode</td><td>00c</td></tr> <tr><td>ccgname_short</td><td>darlington</td></tr>" }
using regex, extract ccg code property , add in above becomes:
"properties": { "name": "darlington", "ccgcode": "00c", "description": "<br><br><br> <table border=\"1\" padding=\"0\"> <tr><td>ccgcode</td><td>00c</td></tr> <tr><td>ccgname_short</td><td>darlington</td></tr>" }
i've tried sorts , can't work. using sublime text.
^("description":").*?<td>ccgcode<\/td><td>([^<>\n]*).*$
the above selects code, not sure how can create property.
try this
( *)"description".*?ccgcode.*?<td>([^<]+)
this 1 sublimetext3
find what:
( *)("description".*?ccgcode.*?<td>)([^<]+)
replace with:
\1"ccgcode": "\3",\n\1\2
Comments
Post a Comment