I get this:
$p= <<<'EOD'
stuff
more
EOD;
print (preg_match ('~^stuff$~m', $p)); // expected 1, got 0
despite
http://php.net/manual/en/reference.pcre.pattern.modifiers.php
the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the subject string, respectively
EDIT: This is in a standard Windows text file.