I'm trying to allow the use of the hyphen (dash) in a text input, but I can't get it to work. I've tried the following with no success:
$string =~ s/[^\w|-]//g;
$string =~ s/[^\w\-]//g;
$string =~ s/[^a-zA-Z0-9-]//g;
I've also tried the ascii code - with and without escaping the & and ;
Any help would be greatly appreciated!