Re: help on regex

From: Date: Fri, 04 Oct 2002 12:32:47 +0000
Subject: Re: help on regex
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118873@lists.php.net to get a copy of this message
> I am trying to learn regex and could need some help. > > There are 2 function I would need. 1 which returns false if the data does > contain anything else than numbers or fullstops > > I tryed this: > function validate_phone ($phone) { > return (ereg('^[0-9][:punct:]', $phone)); > } try using ^[0-9.]*$ > The next one is to return fals if the data does not contain a number inside > the string ("street 893" would be valid) > I tryed this: > function validate_street ($street) { > return (ereg('^[0-9]', $street)); > } try using just [0-9]

« previous php.general (#118873) next »