Match (==~) operator return true, if given text matches
to the pattern, else false.
HelloWorld.groovy
def text = "aaaab" boolean isMatched = text ==~ /a*b/ println "Is aaaab matched to the pattern a*b " + isMatched
Output
Is aaaab matched to the pattern a*b true
No comments:
Post a Comment