You are here: Re: remove numbers from a string « All PHP « IT news, forums, messages
Re: remove numbers from a string

Posted by Fabian Hore on 09/26/05 19:11

// strips out any numeric characters
$newstr = preg_replace('/\d+/', '', $oldstr);


// test for a string of numbers between 7 and 20 digits with optional
whitespace
if( preg_match('/[\d\s]{7,20}/', $mystr) ){
// that looks a bit like a phone number
// handle error
}






"dean" <deanharding@gmail.com> wrote in message
news:1127748462.000368.246860@g47g2000cwa.googlegroups.com...
> hi
> Basiclly I am after a way of removing strings of numbers such as
> telephone numbers from a form submission
> i.e. if someone submitted the data "contact me on 01234 12345678" the
> script would detect the string of numbers and bring up an error
> message.
> I have tried to do it with regular expressions but no luck so far.
> many thanks
> dean
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация