...
| Code Block |
|---|
def list = ['/a/b/c.groovy', 'myscript.groovy', 'groovy.rc', 'potatoes']
// find all items whom a subsequence matches /groovy/
println list.findAll{ it =~ /groovy/ } // => [ "groovy", "/a/b/c.groovy", "myscript.groovy", "groovy.rc", "groovy." ]
// find all items who match exactly /groovy/
println list.findAll{ it ==~ /groovy/ } // => [ "groovy" ]
// find all items who match fully /groovy\..*/ ('groovy' with a dot and zero or more char trailing)
println list.findAll{ it ==~ /groovy\..*/ } // => ["groovy.rc", "groovy."]
|
...