Postgres Replace In String Javascript Program To Calculate