You are here: Re: Regular expression « PHP Language « IT news, forums, messages
Re: Regular expression

Posted by iuz on 12/31/05 16:21

Willem-Jan wrote:

> Hi all,
>
> I have problems checking a string with a regular expression. I use:
>
> ereg("[^A-Za-z0-9-]", $string)
>
> to allow characters, digits and -. What do I have to add to allow a
> space, a comma and ;?
>
> Thanx,
> WJ

in order to check if a string is made only by chars, digits, '-', ';' and
','.. IMHO the correct regex should be..
'/^[a-zA-Z0-9\-;,]+$/'
used with preg_match() function that is often a faster alternative to
ereg()..

--
www.iuz-lab.info

 

Navigation:

[Reply to this 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

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