Re: Regular Expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 24 Nov 2004 13:17:48 -0500, Ankur Os wrote:

> Hi,
> 
> This is quite simpal problem that i want to made regular expression which
> can read this kind of structure...
> 
> a,b,c
> 
> not like this
> 
> 1.  ,a,a,a
> 2.  a,,,aa,,
> 3.  a,a,a,,,
> 
> means simpal structure with comma (a,b,c...)
Hi,

Try this (untested) :

preg_match('/^([a-c],)*[a-c]$/', $input);

this will match characters a-c separated by commas. Replace 'a-c' by any
range of characters you like.

HTH,

Ivo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux