Reputation: 625
I have a query and I'm using split_part
to get value of from certain position:
split_part(fieldname,'{',12)
the result will be like this:
200;1;235}
200;1;237}
200;1;216}
my goal is to grab anything after the second ;
like (235,237,216)
as the number of character after ;
is not static
means sometimes it come 1,2,4 or even 5 digit and the number of character varies depending on the value.
How to do this?
Upvotes: 1
Views: 110
Reputation: 551
Try this:
regexp_matches( split_part(fieldname,'{',12), '\d+;\d+;(\d+)}' )
Upvotes: 2
Reputation: 36107
Try
split_part( trim( '}' from split_part(fieldname,'{',12) ), ';', 3)
Please take a look at this demo: http://sqlfiddle.com/#!15/978bd/5
Upvotes: 0