Check for end-of-string when using the escape character