|
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]
|