#12688 [Com]: preg_match doesn't return newlines in match array
| From: | anal-interracial983 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:13:22 +0000 |
| Subject: | #12688 [Com]: preg_match doesn't return newlines in match array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63151@lists.php.net to get a copy of this message | ||
ID: 12688
Comment by: anal-interracial983 at hotmail dot com
Reported By: jax at uia dot net
Status: Bogus
Bug Type: *Regular Expressions
Operating System: FreeBSD 4.2
PHP Version: 4.0.6
New Comment:
<a href=http://b-ripped-3d-porn-bo.da.ru>interracial
anal</a>
Previous Comments:
------------------------------------------------------------------------
[2001-08-10 11:21:21] jax at uia dot net
Ahhhh,
Heh, sorry about that. I verified that they have deprecated $*! I am
too old for this stuff ;)
Thanks!
Eating crow,
--Liam
------------------------------------------------------------------------
[2001-08-10 11:02:03] alindeman@php.net
that is exactly how it works in perl (and I got the answer to
your bug from my Perl book...)
------------------------------------------------------------------------
[2001-08-10 10:56:39] jax at uia dot net
Why is this bug bogus? Isn't it a valid bug when something doesn't
Work As Advertised or doesn't Work As Expected? If these are really
perl-compatible regexp functions, this is a real, valid bug.
------------------------------------------------------------------------
[2001-08-10 08:49:31] alindeman@php.net
add an "s" to the end of your reg exp.
if (preg_match('/Here(.*)$/s',$someline,$matches)){
^
this mean "treat everything as one line" and it will parse the
newline.
------------------------------------------------------------------------
[2001-08-10 02:20:48] jax at uia dot net
This is not a core dump, but rather an output problem with preg_match.
Here is a short script:
$someline = "Here is some line.\n";
if ( preg_match('/Here(.*)$/',$someline,$matches) ) {
$out = $matches[1];
}
print "<pre>[$out]</pre>";
$out now contains no newline when this clearly should be included!
--Liam
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12688&edit=1