Groovy web console

subscribe to the feed Subscribe
to this
site

Regex-app-name

Published 2 months ago by Wolf
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def name = "@domain/app-name"
def matches = (name =~ /(.*\/)|(.+)/)

if (matches.size() == 2) {
    //App-Name with Domain
    return matches[1][0]
}
else {
    //App-Name without Domain
    return matches[0][0]
}