in reply to Quickie regular expression question.

the some reason is that you are not using code-tags.

As for your question, your code only checks for a single occurence of a digit/letter. Change it to
if ($newpasswd !~ /^[A-Za-z0-9]+$/) { #EXECUTE SOME THINGS; }
or even
if ($newpasswd !~ /^[\w\d]+$/) { #EXECUTE SOME THINGS; }


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: Quickie regular expression question.
by ikegami (Patriarch) on Mar 16, 2005 at 17:28 UTC
    [\w\d] is a much bigger set.
    It includes "_" and the chinese character for "one", for example.
Re^2: Quickie regular expression question.
by Fletch (Bishop) on Mar 16, 2005 at 17:36 UTC

    [:alnum:] would be better than \w\d as that's strictly alphanumerics and should respect locale as well.