if ($newpasswd !~ /^[A-Za-z0-9]+$/) { #EXECUTE SOME THINGS; }