Fix regular expression in connect to look for the $ character instead of the end of line anchor