The method !~is the inverse of =~, that is !(=~). From the Ruby Object#!~documentation :
[obj! ~ other] returns true if the two objects do not match (using the = ~ method), false otherwise.
, String#=~ / , , , nil String#!~ return false, , true .