> 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] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php