All Forums Database
sudhakar1987 2 posts Joined 03/12
05 Mar 2015
How to get a substring until the nth occurance of a character

i have values as follows:

132256711832009^998^R^BCBSTX^2014-03-20

143115179584022^999^R^BCBSIL^2014-11-07

140795460911026^999^R^BCBSOK^2014-03-20

140782836024024^999^R^BCBSIL^2014-03-19

140796806094025^998^R^BCBSIL^2014-03-20

 

i need to get the string until3rd occurance of ^. How can i get the below results?

 

132256711832009^998^R

143115179584022^999^R

140795460911026^999^R

140782836024024^999^R

140796806094025^998^R

 

dnoeth 4628 posts Joined 11/04
05 Mar 2015

Regular expressions are supported since TD14:

REGEXP_SUBSTR(col, '(.*?\^){2}(.*?)(?=\^)')

 

Dieter

You must sign in to leave a comment.