note 30980 added to function.ereg

From: Date: Sat, 05 Apr 2003 07:53:27 +0000
Subject: note 30980 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-46247@lists.php.net to get a copy of this message
I have literally spend half a day, trying to match a whitespace in a string with the ereg function. all tutorials mention the [:space:] and the \s methode, but none seem to work for me. In the end the solution is very simple, although I feel like I am not actually matching the whitespace. It is still a working solution. <code> $data = "123 45"; If (ereg("([0-9]{3}) ([0-9]{2})", $data)) { echo "good"; } else { echo "not good"; } </code> Note the whitespace in the code between the two ([0-9]{x})'s. -- http://www.php.net/manual/en/function.ereg.php http://master.php.net/manage/user-notes.php?action=edit+30980 http://master.php.net/manage/user-notes.php?action=delete+30980 http://master.php.net/manage/user-notes.php?action=reject+30980

« previous php.notes (#46247) next »