Updated the regex, it should not have been checking for \.|$, just $