\)-_
This causes the character class to include all characters between )
and _
, i.e. )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
. 3
is in one of these.
The -
should be placed at the beginning or end, so that it won't be counted as a special character. Also, besides \
, [
, ]
and /
, there's no need to escape anything in a character class.
/[-!"£$%^&*()_+=\[\]{};:@'#\\|<,.>\/?]/
(Technically the [
doesn't need to be escaped either, but for consistency I prefer to escape it. Also, you could match a -
in the middle if you escape it \-
.)