Does Perl's /m regex modifier match differently on Windows?
multiline, perl, regex, windows
Solution
For these regexes:
m/\015\012/ms
m/\015\012/s
Both /m and /s are meaningless.
- /s: makes `.` match `\n` too. Your regex doesn't contain `.`
- /m: makes `^` and `$` match next to embedded `\n` in the string. Your regex contains no `^` nor `$`, or their synonyms.
What is possible is indeed if your input handle (socket?) works in text mode, the `\r` (`\015`) characters will have been deleted on Windows.
So, what to do? I suggest making the `\015` characters optional, and split against
/\015?\012/
No need for /m, /s or even the leading `m//`. Those are just cargo cult.
Problem
The following Perl statements behave identically on Unixish machines. Do they behave differently on Windows? If yes, is it because of the magic \n? ``` split m/\015\012/ms, $http_msg; split m/\015\012/s, $http_msg; ``` I got a failure on one of my CPAN modules from a Win32 smoke tester. It looks like it's an \r\n vs \n issue. One change I made recently was to add //m to my regexes.