Re: Validate Value

From: Date: Sun, 11 Jul 2004 09:11:59 +0000
Subject: Re: Validate Value
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-35192@lists.php.net to get a copy of this message
In article <20040711064659.27961.qmail@web54107.mail.yahoo.com>, Rinku wrote: > --0-775821546-1089528419=:27331 > Content-Type: text/plain; charset=us-ascii > > Pls guide on following. > 1) I want to validate name for a alphabetic value, But if I give space between 2 words then its > not supporting.. That's correct behaviour. The alphabet doesn't know what a space is ;) Thus append the other allowed characters to your a-zA-Z interval. > 2)I want to validate a phone no for 10 digits. But in this value if I enter "+" or > "-" in begining then even > the system will accept it. So can you pls suggest me what to do to solve the problem ? In this case you only want to allow characters in the interval 0-9. I think \d is a shortcut for that. And to limit it to only 10 occurences, i believe you can use {0,10} so you end up with \d{0,10} if i'm not mistaken (consult a regular expressions manual to be sure) -- Tim Van Wassenhove <http://home.mysth.be/~timvw>

« previous php.db (#35192) next »