SQL Language (MOSC)

MOSC Banner

How to extract multiple hostname from a long string by using regexp_substr

edited Apr 1, 2021 9:59AM in SQL Language (MOSC) 5 commentsAnswered

Hi Oracle Community,

I am trying to extract multiple hostname out from long strings. However, my query is only able to extract the first hostname. I did try to put {1,0} after the match pattern  '((HOST|HOSTNAME)[[:space:]]*(\=)[[:space:]]*(\w+|\-|\_)*(\.\w+)*|(\w+|\-|\_)*(\.\w+)+|((\w+|\-|\_)+$)){1,}', but still not able to extract the rest of occurrence match at all. Can someone please help me out? Thanks.

== The query output ===

HOSTNAME

--------------------

LXC01-VIP.TEST.COM


Expected Output

LXC01-VIP.TEST.COM LXC02-VIP.TEST.COM


-------------------------------- My current query ----------------------------------

SELECT 

    REGEXP_REPLACE (

     REGEXP_REPLACE (

       REGEXP_REPLACE (

        REGEXP_SUBSTR (

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center