class Ideone {
static void main(String[] args) {
def list1= ["README.md", "test1.txt","/desktop/openmpi.txt"]
print(list1.any { it =~ /(?i)\.(?:md|txt)$/ } )
}
}
Y2xhc3MgSWRlb25lIHsKICAgIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCWRlZiBsaXN0MT0gWyJSRUFETUUubWQiLCAidGVzdDEudHh0IiwiL2Rlc2t0b3Avb3Blbm1waS50eHQiXQoJCXByaW50KGxpc3QxLmFueSB7IGl0ID1+IC8oP2kpXC4oPzptZHx0eHQpJC8gfSApCiAgICB9Cn0K