title: PostgreSQL - query JSON and replace JSON values
body: <p>In Postgres DB one of the columns has this JSON data posted below. </p>
  
  <p>When I do 'Select' query for that column - I want to replace JSON values of 'lib-One-5dc422e9f21531f9dbc16fd0' and 'lib-Six-5dc422e9f21531f9dbc16fd0' with just lib-One- and lib-Six- etc. </p>
  
  <p>Am new to postgres and have been trying to figure this out for a while. </p>
  
  <p>Basically replace any <code>lib-*-[0-9]</code> values with just <code>lib-*-</code></p>
  
  <pre><code>{
     "data":{
        "Library":{
           "Checkout":{
              "invoiceId":"12dfdf454546",
              "checkoutDetail":{
                 "invoiceTransactionId":"5ab422e9f21531f9dbc16fd6",
                 "invoicePaymentDetail":{
                    "objectId":"lib-One-5dc422e9f21531f9dbc16fd0",
                    "checkoutPeriods":[
                       {
                          "startDate":"2017-04-14T19:00:00.000",
                          "endDate":"2017-05-19T19:00:00.000"
                       }
                    ],
                    "invoice":{
                       "objectId":"lib-Six-5dc422e9f21531f9dbc16fd0",
                       "checkObject":true
                    }
                 }
              }
           }
        }
     }
  }
  </code></pre>