Regex doesn't match end of line with both carriage return and line feed

I was trying to use the Regex feature where ^ and $ match the start and end of individual lines instead of the whole string, and I noticed that:

$ match(r"does$"m, "this does\r\nnot work")

$ match(r"does$"m, "this does\nwork")
RegexMatch("does")

Is this as expected, or is this a bug?

This behavior depends on how the underlying regexp library was compiled. You can do this to override the default behavior:

julia> match(r"(*ANYCRLF)does$"m, "this does\r\nso work")
RegexMatch("does")

(See the Wikipedia article on PCRE for details, especially alternative versions of the EOL spec.)

Great explanation, thank you!