in reply to How to Detect Mixed File Line-Endings

Your regular expression does not check whether the \015 or the \012 or the \015\012 is really the last thing on the line.

This can be fixed by by anchoring your regular expression to the end of the string:

/(\015|\012|\015\012)\z/

Replies are listed 'Best First'.
Re^2: How to Detect Mixed File Line-Endings
by robby_dobby (Hermit) on Jan 18, 2014 at 13:15 UTC
    In the interest of a longer match first, I think OP should change the regex to test for CRLF first followed by either of CR or LF.

    m!\015\012|\012|\015!