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!

Find Repeating pattern from the long string

J1604Oct 10 2019 — edited Oct 14 2019

Hi everyone

My Database is Oracle 12c R 12.1.0.2

I am looking for a regular expression or Substr/Instr query to find repeating pattern from a long string and eliminate them

Input                                                                                      Output

9999 W San Brazil St Ste A Ste A:48:77774:4444               9999 W San Brazil St Ste A:48:77774:4444  

with t as (

         

           select '9999 W San Brazil St Ste A Ste A:48:77774:4444' addr from dual

          )

-- end of on-the-fly data sample

select  addr,

        regexp_replace(addr,'^(.+?)\1*$','\1') sub_str

  from  t

above query doesn't return the Output I am looking for

Can someone please guide me

Thanks

J1604

This post has been answered by Frank Kulash on Oct 10 2019
Jump to Answer
Comments
Post Details
Added on Oct 10 2019
12 comments
736 views