'~' does not exist as an expression (in the sense that it would evaluate to something) in almost any software I know. Also in awk, respectively perl ('=~'), it is only an (relational) operator, e.g. in awk it says "the following must match" or "must not match" (see above, good example, btw)...