From: madsen at sjovedyr dot dk Operating system: Debian Linux (Woody) Unstable PHP version: 4.3.2 PHP Bug Type: Regexps related Bug description: Match on '[' and ']' fails.
Description: ------------ Attempting to use ereg() for matching the date from an Apache error_log fails, when using the pattern: "^\[([^\]]*)\]" Intention of the pattern explained (in case I just can't see the error in it): ^\[ - Require first char in string to be a litteral '['. ([^\]]*) - Match any number of chars that is NOT ']'. \] - Match a litteral ']' When using this pattern in ereg(), like: ereg("^\[([^\]]*)\]", $string, $regs); $regs has returned empty, when printed by a print_r(); But then if I use "^\[(.*)\]" as my pattern, I get something in $regs, not the right match, since it then runs in 'greedy mode', and catches what's between *(* and *)*: [*(*Aug 25 2002 14:53:32] [error] [client: 88.99.111.222*)*] ... It's really confusing me... If this is not a bug I apologise, but I think I have taken every form of action required before reporting this as a bug. -- Edit bug report at http://bugs.php.net/?id=24242&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24242&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24242&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24242&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24242&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24242&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24242&r=support Expected behavior: http://bugs.php.net/fix.php?id=24242&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24242&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24242&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24242&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24242&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24242&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24242&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24242&r=gnused