Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2004071

[PHP-DB] Re: Validate Value From: Tim Van Wassenhove (euki <email protected>)
Date: 07/11/04

In article <20040711064659.27961.qmail <email protected>>, 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>

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