Used .strip() instead of regexs to remove new line characters at the end of a string.