Reputation: 73
pattern: d0=123;d1=134;d2=123;d3=13;d4=33;d5=44;d6=55;
If want to get the first number between =
&
;
output:
123
If I want to get the second occurrence between =
&
;
output:
134
regex used:
select
regexp_substr(' d0=123;d1=134;d2=123;d3=13;d4=33;d5=44;d6=55;','d[0-9]+=' ,1,2) as b;
but output is coming like this:
d1=
Any pointers in this direction will be helpful.
Upvotes: 3
Views: 3565
Reputation: 82
Another approach would be to use regex_substr instead
regex_substr(s,'[^d=;]*[0-9]+[^;=d]',1,2)
Increment/decrement the integer value 2 as needed.
Upvotes: 2