[PHP-DEV] Bug #862 Updated: problem in eregi() From: Bug Database (php-dev <email protected>)
Date: 10/29/98

ID: 862
Updated by: rasmus
Reported By: markjr <email protected>
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:

You have a number of problems in your regular expressions there. First, there is no such thing as \- and even if there was you would have to write it as \\- because inside a double-quoted string in PHP escape chars are parsed. In order to get the eregi() function to see \- you would have to escape the \ and thus have \\-. That isn't you problem though. I quote from the Extended Regular Expression docs (see regex/regex.7 in the PHP distribution):
To include a literal `]' in the list, make it the first
character (following a possible `^'). To include a lit-
eral `-', make it the first or last character, or the sec-
ond endpoint of a range. To use a literal `-' as the
first endpoint of a range, enclose it in `[.' and `.]' to
make it a collating element (see below). With the excep-
tion of these and some combinations using `[' (see next
paragraphs), all other special characters, including `\',
lose their special significance within a bracket expres-
sion.
So, this tells you that you cannot put a '-' in the middle of a range like that. I do not think this is a bug in PHP. PHP's behaviour is entirely consistent with that definition.

Full Bug description available at: http://ca.php.net/bugs.php3?id=862

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>