note 55290 deleted from function.ereg by nlopess
| From: | nlopess@php.net | Date: | Sun, 02 Oct 2005 18:06:25 +0000 |
| Subject: | note 55290 deleted from function.ereg by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96210@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Beware that eregs in PHP4 are broken, for instance if you want to match "a to z, 0,9 and
-" you might want to use [a-z0\-9] but it will silently fail due to a bug : the \ don't
escape some special chars, so this regexp is equivalent to [a-z0-9] ! Also putting \[ or \] inside
the brackets (to match for a bracket) doesn't work, or raises an error, but curiously putting
the \- at the end works. So if you want to match '[a-z\|\[\]]' you have to type
'([a-z]|\-|\[\|])'
This isn't a misplaced bug report : I put this here so other users don't lose a few hours
like I did tracking it down.
Workaround : use preg, you'll be faster learning the preg syntax than trying to make ereg work
by tweaking the expression.