Corrected matching for $ instead of newline