title: How to do regexp for add new json element in Postgres
body: <p>What I have and what I know: </p>
  
  <ul>
  <li>json array like {"home":["1","2","5"], "work":["15","16","19"]}</li>
  <li>new integer element ("11" for example) </li>
  <li>place for new element "home" or "work" ("home" for example)</li>
  </ul>
  
  <p>What I need:</p>
  
  <ul>
  <li>Add this element to end of json array in right place</li>
  <li>Do it with reqular expression</li>
  <li>Do it in postgreSQL with regexp_replace</li>
  <li>Result must be like this: {"home":["1","2","5","11"], "work":["15","16","19"]}</li>
  </ul>
  
  <p>What I was try:</p>
  
  <pre><code>SELECT regexp_replace('{"home":["1","2","5"], "work":["15","16","19"]}', '(.*)("home":\[)(("[0-9]*",)*("[0-9]*")*)(\])(.*)', '\1\2\3,"11"\6\7', 'g');
  </code></pre>
  
  <p>What I don't know:
  - What if place will be "home":[] and I must put "11" without ","! how?</p>