in reply to Re: How do I keep anything other than alphanumeric out of a variable?
in thread How do I keep anything other than alphanumeric out of a variable?

One caviet here: POSIX.

POSIX can, on some systems, alter the definition of \W so tht its conventional meaning, "[^a-zA-Z0-9_]", is not exactly what you expect it to be.

According to Friedl (the Owls book "Mastering Regular Expressions", 1st edition, pp. 65-66 and 257) (paraphrasing...):

Therefore, it is in some cases advisable to use the following construction to accomplish the task described in the subject line of this thread:

$user_name =~ s/[^a-zA-Z0-9]//g;

Or with case insensitivity:

$user_name =~ s/[^a-z0-9]//gi;

Of course this solution more accurately answers the question: "How do I purge anything other than Alpha/Numeric data from a variable?"

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein