in reply to Re: RegEx Character Class
in thread RegEx Character Class

To keep "/", please add "\/"

If using alternate delimiters, there's no need to protect '/'.

$code =~ s/[^\/\w"':.;]//g;

BTW: this is a perhaps a job better suited for tr///d, except that it doesn't support \w and one would have to hardcode the ranges - and it may even be worse if unicode were involved, but the OP may like to know anyway.