hasPrefix: instead of hasSuffix: in endOfLine

Could lead to duplication of trailing `$`s otherwise