note 64266 added to function.ereg

From: Date: Tue, 11 Apr 2006 06:13:16 +0000
Subject: note 64266 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-107741@lists.php.net to get a copy of this message
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? ---- Server IP: 203.220.0.234 Probable Submitter: 143.216.49.250 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.ereg.php Edit -- http://master.php.net/note/edit/64266 Del: integrated -- http://master.php.net/note/delete/64266/integrated Del: useless -- http://master.php.net/note/delete/64266/useless Del: bad code -- http://master.php.net/note/delete/64266/bad+code Del: spam -- http://master.php.net/note/delete/64266/spam Del: non-english -- http://master.php.net/note/delete/64266/non-english Del: in docs -- http://master.php.net/note/delete/64266/in+docs Del: other reasons-- http://master.php.net/note/delete/64266 Reject -- http://master.php.net/note/reject/64266 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107741) next »