Reply to Re: [PHP] check for alphanumeric characters

Your name:

Reply:


Posted by Matthew Weier O'Phinney on 04/29/05 20:01

* John Nichel <john@kegworks.com>:
> Diana Castillo wrote:
> > what kind of a function can I use that will tell me whether a variable is
> > alphanumeric (that is has only characters A-Z or 1-9 )?
>
> Something like this should work. (untested)
>
> preg_match ( "/^([a-z]||[A-Z]||[0-9])+$/", $string )

It can be simpler than that, actually:

preg_match('/^[a-z0-9]+$/i', $string)

(tested and works)

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация