Anchor $
does not include the newline character. In fact it is a zero-width token. It matches the empty character just before the first newline in your string. And hence the result.
Similarly, ^
matches an empty character before the first character in your string.
See http://www.regular-expressions.info/anchors.html for more details.