Why are you looking for a space here, shouldn't it be a check for a semicolon?