<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def termfinder(self, pattern):
 """Search srt in project for cells matching term."""


        if Config.options.regex:
            flags = re.M | re.S | \
                (0 if Config.options.case_sensitive else re.I)
            self.project.set_search_regex(
                pattern, flags=flags)
        else:
            self.project.set_search_string(
                pattern, ignore_case=not Config.options.case_sensitive)

        matches = []

        while True:
            try:
                if matches:
                    last = matches[-1]
                    new = self.project.find_next(last + 1)[0]
                    if new != last and new > last:
                        matches.append(new)
                    else:
                        break
                else:
                    matches.append(self.project.find_next()[0])
            except StopIteration:
                break

        return matches