Hello,
could someone help with the following code:

text = 'test'
def matcher = text =~ /(test)/
print matcher.group(1)

getting error:
java.lang.IllegalStateException: No match found

but the following code works as expected:

text = 'test'
def matcher = text =~ /(test)/
if (matcher ) {
    print matcher.group(1)
}

Thanks!