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!

Split a html string into multiple rows

user2022369Jun 20 2014 — edited Jun 22 2014

I am trying to convert a string into multiple rows using REGEX, can someone tell me if this is accomplishable using oracle regular expressions

       WITH qry AS (

                      SELECT   '<p>one</p><p>two</p><p>three</p>' as str 

                       FROM    DUAL

       )

       SELECT

       --regexp_replace(

       --regexp_replace(

       regexp_substr (str,

       '[^<(/?)p>].*', 1, LEVEL)

       --,'<p>','')

       --,'</p>','')

       ab

       FROM    qry

       CONNECT BY LEVEL  <= LENGTH(regexp_replace (str, '[^<(/?)p>].*'))+1

       ;

Current Output:

1 one</p><p>two</p><p>three</p>

2 (null)

3 (null)

4 (null)

Expected Output:

1 one

2 two

3 three

This post has been answered by Solomon Yakobson on Jun 22 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2014
Added on Jun 20 2014
15 comments
921 views