It's not a bug. The regex is simply wrong. The ereg() functions are POSIX 1003.2 compliant. Read this:
A bracket expression is a list of characters enclosed in `[]'. It normally matches any single character from the list (but see below). If the list begins with `^', it matches any single character (but see below) not from the rest of the list. If two characters in the list are sepa rated by `-', this is shorthand for the full range of characters between those two (inclusive) in the collating sequence, e.g. `[0-9]' in ASCII matches any decimal digit. It is illegal- for two ranges to share an endpoint, e.g. `a-c-e'. Ranges are very collating-sequence-dependent, and portable programs should avoid relying on them. 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. Nowhere does it say that \- is a valid way to get a literal - inside a bracketed expression. -Rasmus On Tue, 14 May 2002, Chand wrote: > hey, > > i've come across a bug these past few days in regexps, i've been getting mad about >this. I looked around in the Bug Database and i found it : > > http://bugs.php.net/bug.php?id=11461 > > it's from 4.0.6, dated almost a year and still hasn't been corrected and is not even >assigned > Any ideas why this has been put off ? It still 'works' on php 4.2.0RC4, haven't >tried further.. > > Thanks for any insight as to why this hasn't been solved yet. > > Later > > -- > Chand > > "640K ought to be enough for anybody." > Bill Gates, 1981 > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php