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!

Case insensitive replace keeping the source case

ligonglFeb 19 2014 — edited Feb 19 2014

Hi All,

I am trying to replace key words with some html tag wrapped around it. The match for keywords needs to be case insensitive but should retain the original keywords case.

So far I have this:

WITH DATA AS

(SELECT 'I seek aN anSwer please' val, 'An Answer' keyw FROM DUAL)

SELECT REGEXP_REPLACE(val,keyw,'<a href="answer_url">'||keyw||'</a>',1,0,'i')rslt,val,keyw

FROM data;

The result is

I seek <a href="answer_url">An Answer</a> please

Is it possible to get the following (i.e retaining the original case of the source)

I seek <a href="answer_url">aN AnSwer</a> please

Thank you

Ligon

This post has been answered by Frank Kulash on Feb 19 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 19 2014
Added on Feb 19 2014
2 comments
454 views