Split space delimited string with regexp SQL

Split up a delimited string with:

SELECT REGEXP_SUBSTR ( 'Hello world !' , '[^ ]+' , 1 , 1 )
     , REGEXP_SUBSTR ( 'Hello world !' , '[^ ]+' , 1 , 2 )
     , REGEXP_SUBSTR ( 'Hello world !' , '[^ ]+' , 1 , 3 )
  FROM DUAL ;

Output:

REGEX REGEX R
----- ----- -
Hello world !

From http://psoug.org/reference/regexp.html

Posted in Scripts
One comment on “Split space delimited string with regexp SQL
  1. Ross says:

    Very nice

Leave a Reply

Your email address will not be published. Required fields are marked *

*