const regex = new RegExp('([^ =,\\[\\]\\{\\}]+)=([^ =,\\[\\]\\{\\}]+)', 'gm')
const str = `[{idEvento.\$oid=63ffaec3cdc01e6352729bad, dataHoraEvento.\$date=1677690003377, codigoTipoEvento=1, mesAnoReferenciaContabilizacao=032023}, {idEvento.\$oid=63ffb5c8cdc01e6352729bae, dataHoraEvento.\$date=1677691800676, codigoTipoEvento=3, mesAnoReferenciaContabilizacao=032023}, {idEvento.\$oid=6405cc8711c78c20369b4033, dataHoraEvento.\$date=1678090851560, codigoTipoEvento=8, mesAnoReferenciaContabilizacao=032023}, {idEvento.\$oid=6422b4c97e45dd75abb4f831, dataHoraEvento.\$date=1679985307560, codigoTipoEvento=6, mesAnoReferenciaContabilizacao=032023, _class=br.com.bb.rcp.model.vantagens.HistoricoContabil}, {idEvento.\$oid=6422b4c97e45dd75abb4f832, dataHoraEvento.\$date=1679985309584, codigoTipoEvento=6, mesAnoReferenciaContabilizacao=032023, _class=br.com.bb.rcp.model.vantagens.HistoricoContabil}]`;
const subst = `"\g<1>":"\g<2>"`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions