flushing out a tricky bug with newline regex matching, still a bug remains