I'm trying to fix some code written by another developer:
$rexSafety = '@[0-9-\+\s\(\)]+$@';
if (!preg_match($rexSafety, $_POST['phone'])) $spam = true;
When I type in an 11-digit number (UK standard phone length) without spaces or any other characters, the number (from $_POST['phone']
) is marked as spam.
Unfortunately I don't know anything about regular expressions so I was hoping someone would be able to 'decipher' this and tell me what it is expecting?
01234567890
should be a match. It's currently not.