$string =~ tr/A-Za-z0-9.-_//cd;You forgot to escape the hyphen, the one you want taken literally:
$string =~ tr/A-Za-z0-9.\-_//cd;
Yours will keep everything in the range
too, which is more than you wanted../0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
In reply to Re^2: regex question
by bart
in thread regex question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |