$ is not matching a position immediately before a newline that is the last character.
Ideally /1…$/ should match but match happens with the pattern /1….$/ which seems to be wrong.
What could be the reason?
PHP doc also says A dollar character ($) is an assertion which is TRUE only if the current matching point is at the end of the subject string, or immediately before a newline character that is the last character in the string (by default).
$subject = 'abc#
123#
';
$pattern = '/1...$/';
preg_match_all($pattern,$subject,$matches); // no match
Update:
I suspect extra dot due to \r\n format of newline.
I did following experiment and see some hint.
$pattern = '/1...(.)$/';
echo bin2hex($matches[1]); // 28
28 seems to be equal to \r (CR) so basically $ is matching before \n not before \r\n, that may be the reason of my problem.

Image after non printable character turn on
Issue was due to different newline representation of window file and linux file
Why this issue:
Below experiment confirmed the same:
Created new file in linux system and /1…$/ catches the match 🙂
I hope this will save someone’s time if stuck with same problem.