#36900 [Opn->Bgs]: \s incorrectly matches new-line in multi-line mode

From: Date: Tue, 28 Mar 2006 21:41:33 +0000
Subject: #36900 [Opn->Bgs]: \s incorrectly matches new-line in multi-line mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95030@lists.php.net to get a copy of this message
ID: 36900 Updated by: tony2001@php.net Reported By: andrew dot minerd at sellingsource dot com -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Gentoo Linux PHP Version: 5.1.2 New Comment: PHP doesn't parse regular expressions, it just wraps PCRELib. And if PCRELib behaves wrong - there is nothing we can do about it. Previous Comments: ------------------------------------------------------------------------ [2006-03-28 23:33:46] andrew dot minerd at sellingsource dot com Description: ------------ When using multiline mode in a regular expression, \s incorrectly matches a new-line character. Reproduce code: --------------- $info = <<<INFO Sender: Pages: 1 INFO; preg_match_all('/^\s*([^:]+?):\s*(.*)$/m', $info, $matches, PREG_PATTERN_ORDER); // combine into an array of key=>value pairs $info = array_combine(array_map('strtolower', $matches[1]), $matches[2]); var_dump($info); Expected result: ---------------- array(2) { ["sender"]=> string(0) "" ["pages"]=> string(1) "1" } Actual result: -------------- array(1) { ["sender"]=> string(8) "Pages: 1" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36900&edit=1

« previous php.bugs (#95030) next »