try this:

unless (/^[-\.\w]+$/) { print "you cheater!" }

this will check if from beginning to end of $_ it contains - . (not even sure
you need to \ the . ) or any word character (a-z A-Z and _ )

the ^ says to start at the beginning of the string... the $ says to read till
end of line...

i'm on a machine without perl here, so the string is untested...

hth,

Jos Boumans

[EMAIL PROTECTED] wrote:

>     if ( $add_alias =~ /\@/ ) {
>
> right now i am testing a variable to see if it contains an \@ character. i
> would prefer to test it to see if it has anything *other* than
> a-zA-Z0-9\.\-\_
>
> can i do this with a regex like
>
>     if ( $add_alias =~ /[^a-zA-Z0-9\.\-\_]/ ) {
>
> i am not certain if my search range is too broad.

Reply via email to