if ($chart_name =~ /^([-\@\w.]+)$/) { #good data } else { die; }