note 101090 rejected from function.preg-match by thiago
| From: | thiago@php.net | Date: | Thu, 25 Nov 2010 13:30:32 +0000 |
| Subject: | note 101090 rejected from function.preg-match by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174351@lists.php.net to get a copy of this message | ||
Note Submitter: lists dot p at jynxy dot net
----
I have a problem with multiline matching of .* not being as greedy as it should be.
If I use:
preg_match("/([^\n\r,]+)[\n\r,](.*)/ms", $addr,$out)
The second parenthesis-expression containing the ".*" should surely match to the end of a
multiline string. Instead it just seems to match to the next newline - or something similar. The
idea was that the $1 parameter contains the first part of the string up to the first newline or
comma, while $2 contains the rest. I can work around it but I don't see why it doesn't
work. Is this a bug?