in reply to check if string contains anything other than alphanumeric

(Update: whoops! jwkrahn did mention it below.)

I don't think anyone has mentioned the POSIX character class syntax: alnum. Those and more are in the perlre. They don't work in older versions of Perl, IIRC.

# match (all are alphanumeric) /\A[[:alnum:]]+\z/ # doesn't match (any single is not alphanumeric) /[^[:alnum:]]/