fix the regex used by get_remainder_name, add tests for get_remainder_name