note 30980 deleted from function.ereg by didou

From: Date: Sun, 07 Dec 2003 03:01:20 +0000
Subject: note 30980 deleted from function.ereg by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61560@lists.php.net to get a copy of this message
Note Submitter: sankyu_chuohao at hotmail dot com ---- 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.

« previous php.notes (#61560) next »