The documentation mentions three regex specific operators:
~
returning aPattern
=~
returing aMatcher
==~
returning aboolean
Now, how can I negate the last one? (I agree that the others can't have any meaningful negation.)
I tried the obvious thinking:
println 'ab' ==~ /^a.*/ // true: yay, matches, let's change the input
println 'bb' ==~ /^a.*/ // false: of course it doesn't match, let's negate the operator
println 'bb' !=~ /^a.*/ // true: yay, doesn't match, let change the input again
println 'ab' !=~ /^a.*/ // true: ... ???
I guess the last two should be interpreted like this rather:
println 'abc' != ~/^b.*/
where I can see new String("abc") != new Pattern("^b.*")
being true
.