You are here: Re: best way to validate this data « All PHP « IT news, forums, messages
Re: best way to validate this data

Posted by Benjamin on 12/08/06 03:32

Bosconian wrote:
> I need a way to validate the followng data with these restrictions:
>
> no leading and trailing white space
> no trailing comma
> double quoted numeric/alpha pairs
> each pair on a separate line
>
> For example:
>
> "1","Peter"
> "2","Paul"
> "3","Mary"
>
> Any help is appreciated.
A regular expression would be great here. Try this:
preg_match($data, "/^(\"\d+\",\"[A-Za-z]+\")+$/")

 

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

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