Reputation: 919
My Data Field In A Postgres Table Contains:
{"people":0}
I want to only display the number character zero as a result.
I tried using the trim function from the Postgres manual but that seems to only trim both leading and trailing characters when they are the same.
How could I go about trimming the above data field to simply return:
0
I tried doing
trim(leading '{"people":' from jobs.data)
But that simply results in:
0}
Upvotes: 1
Views: 105
Reputation: 5621
Perhaps this can be done with regexp_replace
select regexp_replace(regexp_replace('{"people":100}', '(.*):',''), '}','');
Upvotes: 1