Correction:  That should be [a-z0-9]+. (note the plus)

-----Original Message-----
From: Timothy Johnson
To: 'Alex Cheung Tin Ka '; '[EMAIL PROTECTED] '
Sent: 11/13/02 12:01 AM
Subject: RE: match only a-z or 0-9

 
You've essentially already done it.  [a-z0-9] is a character class that
includes all characters within that range.  So something like this would
work:

if($string =~ /^[a-z0-9]$/){
  print "It's only letters and digits.\n";
}else{
  print "There's something else in there.\n";
}

-----Original Message-----
From: Alex Cheung Tin Ka
To: [EMAIL PROTECTED]
Sent: 11/12/02 11:14 PM
Subject: match only a-z or 0-9

Dear All,
    Could anyone tell me how to make a regular expression for match a
string only [a-z0-9] ?

Thanks

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to