According to the User Guide
section on pattern matching
The right parameter is a pattern which the left parameter is matched against.
As above, but the two parameters must be numerically equal."
If I interpret that correctly, you fixed it by replacing the operator used to compare numeric values (=) with the one that is to compare strings (~). Got bit by that myself the other day!