Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

REGEXP_REPLACE - Is this strange Or Am I Missing something?

jeneeshDec 5 2012 — edited Dec 6 2012
Hi All,

I was trying to use REGEXP_REPLACE to solve 2474213

And feels strange, when seeing the difference between the below two outputs STRING1 and STRING2 ( My DB - Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production).

The only difference in the two patterns is the additional "$" at the end in the first pattern
with t as
(select 'WEEKLY(.417,''THURSDAY'')x' repeat_interval from dual)
SELECT
  repeat_interval,
  regexp_replace(repeat_interval,'.*?''([^'']+)''.*$','\1') STRING1,
  regexp_replace(repeat_interval,'.*?''([^'']+)''.*','\1') STRING2
FROM  t;

REPEAT_INTERVAL          STRING1         STRING2       
------------------------ --------------- ---------------
WEEKLY(.417,'THURSDAY')x THURSDAY        THURSDAY)x  
Is it strange ( Or I need a coffee?)

Thanks,
jeneesh
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2013
Added on Dec 5 2012
25 comments
4,729 views