|  | Posted by Andy Hassall on 02/16/06 01:18 
On Thu, 9 Feb 2006 14:02:04 -0800, "Jim Michaels" <jmichae3@nospam.yahoo.com>wrote:
 
 >>> How can I know if a string only has alfanumeric chars?
 >
 >give him an example!
 >
 >preg_match('/^[\w\d]$/', $string);
 
 \w includes more than alphanumeric (it includes underscore), but includes all
 of \d.
 
 Alternatives could be:
 
 /^[a-zA-Z\d]+$/
 
 ... or even ...
 
 /^[^\W_]+$/
 
 ... for ASCII definitions of "alphanumeric", anyway.
 
 --
 Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
 http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
  Navigation: [Reply to this message] |