Groovy web console

subscribe to the feed Subscribe
to this
site

test regexp

Published 4 months ago by kjasinski
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
["1a","1.2","1.3"].collectEntries { [it, it.split(/\./).collect { (it =~ /([0-9]+).*/)[0][1] }.collect{ it.toInteger() }]
    }.sort { a, b ->
        [a.value, b.value].transpose().findResult { x, y -> x <=> y ?: null } ?:
            a.value.size() <=> b.value.size() ?:
            a.key <=> b.key

    }.keySet()[-1]