Re: Regular Expression

From: Date: Thu, 25 Nov 2004 12:56:32 +0000
Subject: Re: Regular Expression
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-202846@lists.php.net to get a copy of this message
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

« previous php.general (#202846) next »