{ no locale; if ( $string =~ /([\w\-\_]+)/ ) { $clean_string = $1; } else { die "ilegal character: $!"; } }