note 64266 deleted from function.ereg by bjori

From: Date: Tue, 11 Apr 2006 11:41:19 +0000
Subject: note 64266 deleted from function.ereg by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107760@lists.php.net to get a copy of this message
Note Submitter: ---- ok, maybe i'm just plain stupid, but not once in 7 years of PHP developing I have managed to use this function in a working RELIABLE context. Not in PHP3, 4 or 5. How can this be? What am I doing wrong? I'm currently writing a function to check whether a string could be used as a SMS sender ID: Gotta be numeric OR start with a letter followed by letters or numbers - nothing else. So here's my ereg: $pat = "^[a-zA-Z]{1}[[a-zA-Z0-9]"; $eregTest = ereg($pat,$newSMS); if (!$eregTest){ goBack("For an alphanumeric sender ID the first character must be a letter any other characters may be a letter or a digit."); } This works 2 out of three times, then it just "slips" , i.e. an entry like asd@# doesn't get sent back. I've given up on this. What am I doing wrong?

« previous php.notes (#107760) next »