I have a string 'TICKER: IBM IBM Corporation Inc.' and I want to remove the ticker and its value and grab just the remaining in Oracle PL/SQL.
So I made this query but it is not working the way I intended:
SELECT REGEXP_REPLACE(
'TICKER: IBM IBM Corporation Inc.',
'(.*):[[:space:]](.*)[[:space:]](.*)', '\3')
FROM dual;
I was hoping that '\3' would yield me 'IBM Corporation Inc.' but I get just 'Inc.' as the result.
REGEXP_REPLACE('TICKER:IBMIBMCORPORATIONINC.','(.*):[[:SPACE:]](.*)[[:SPACE:]](.*)','\3')
-----------------------------------------------------------------------------
Inc.
1 rows selected
Update:
SELECT REGEXP_REPLACE(
'TICKER: IBM IBM Corporation Inc.',
'(.*):[[:space:]](.*)[[:space:]](.*)', '\1|\2|\3')
FROM dual;
Result:
REGEXP_REPLACE('TICKER:IBMIBMCORPORATIONINC.','(.*):[[:SPACE:]](.*)[[:SPACE:]](.*)','\1|\2|\3')
--------------------------------------------------------------------------------
TICKER|IBM IBM Corporation|Inc.
What am I missing in the regular expression?
Thanks.
'\2'? See also: docs.oracle.com/cd/B19306_01/server.102/b14200/…