Groovy web console

subscribe to the feed Subscribe
to this
site

tabassum

Published 7 days ago by tabassum
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def output  = """ define contact{        contact_name                    IPNOC        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 = [:]
def names =[];
def fnames = []
def falias = []
def alias =[];
String nametemp = output.findAll(/(?<=contact_name).*/)
names= nametemp .replaceAll(" ","")
fnames.add(names)
String aliastemp = output.findAll(/(?<=alias).*/)
alias = aliastemp .replaceAll(" ","")
//falias.add(alias)
//for (i=0; i<fnames.size(); i++)
//{ result.put(fnames[i], falias[i]) }
println(names)