Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check a variable

Status
Not open for further replies.

donny750

Programmer
Joined
Jul 13, 2006
Messages
145
Location
FR
hi,

I've script where a person take a values and i will to check if the value contain no spaces, no special caracter ( "';,:*)...).
I must have juste number and letter for example
SJsjs12 : good
12ssaff : good
dds14'"12 : not good

i'v make this
Code:
if ($var =~ m/^\w+\d+/){
 
 
print $var."good value\n";
}

but when i run my script
if the person take d120'"44 it's run but i must not run because i've '".

Thanks
 
Code:
/^[A-Za-z0-9]+$/
allows A through Z, a through z, and 0 through 9. In any order, minimum of one character.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
thanks men
it check if the first character is alphanumeric,and the next character and....until the end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top