Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- question about preg_*'s s modifer
February 5, 2007, 7:24 pm
rate this thread
$contents = file_get_contents('preg_test.txt');
echo preg_match("#(.*?)[\r\n]+ddddddddddddd#s",$contents) ? 'is
equal' : 'is not equal';
(it's a malformed part of a postscript file, in case you're curious)
My question is... when I remove the s modifier, preg_match returns
true. When the s modifier is there, it returns false. I'm not really
sure why this is. The s modifier means that . includes new lines and
carriage returns. In either case, it seems like it should match.
Any ideas as to why it doesn't?