In Groovy, you also need to know that in addition to ==~ , the alias "Match Operator", there is also =~ , the alias "Find Operator" and ~ , the alias "Template Operator".
Everything is explained here .
==~ Result type: Boolean / Boolean (there are no primitives in Groovy, everything is not as it seems!)
=~ Result type: java.util.regex.Matcher
~ Result Type: java.util.regex.Pattern
I assume that the Groovy interpreter / compiler can distinguish between ~ used as a Pattern operator and ~ used as bitwise NOT (that is, its use in Java) through context: the first will always be followed by a pattern that will always be enclosed in brackets in delimiters, usually.
source share