Groovy web console

subscribe to the feed Subscribe
to this
site

extract string

Published 3 weeks ago by Tabassum with tags not mapping result
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def output  = """ define contact{        contact_name                    IPNOC
        alias                           Network Monitoring Center
        email                           ip-noc@libertyglobal.com
        use    default_user
        }
define contact{
        contact_name                    dmariuscatalin
        alias                           Diaconu Mariuscatalin
        email                           madiaconu.contractor@libertyglobal.com
        use                             default_user
        }
define contact{
        contact_name                    egriffiths
        alias                           Eddie Griffiths
        email                           egriffiths@libertyglobal.com
        use                    notif_disabled
        }
define contact{
        contact_name                    jcollis
        alias                           James Collis
        email                           jcollis@libertyglobal.com
        use    default_user

        }"""

def result = output.findAll(/(?<=contact_name).*/)

println result

def data = output.findAll(/(?<=alias).*/)

println data