On Wed, 2008-03-05 at 07:13 -0800, It Maq wrote: > Hi, > > I am using that right now and i have don't know how to include blank fields. For example if a user does not fill a field in a form i want to accept it. I tried the code you posted, for now it is blocking blank fields. > > Thank you > > ----- Original Message ---- > From: Richard Lynch <ceo@xxxxxxxxx> > To: Adil Drissi <adil.drissi@xxxxxxxxx> > Cc: php-general@xxxxxxxxxxxxx > Sent: Tuesday, March 4, 2008 3:09:09 PM > Subject: Re: regular expressions question > > On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: > > Is there any way to limit the user to a set of characters for example > > say i want my user to enter any character between a and z (case > > insensitive). And if the user enters just one letter not belonging to > > [a-z], this will not be accepted. > > > > I tried eregi('[a-z]', $fname) but this allows the user to enter > > abdg4512kdkdk for example. > > What you tried only requires ONE a-z character somewhere in the input. > > Try this: > > preg_match('^[a-z]+$', $fname); preg_match('^[a-z]*$', $fname); Someone else posted this also, but you may have missed it. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php