def re_parser(self, scode, *args):
        """
        args: [arg1, arg2]

        arg[0] = a valid regex pattern

        arg[1] : if startswith('@') call sub; if startswith('$') call finditer,
                 $0, $1 means group index.

        return an ensure_list
        """

        def gen_match(matches, num):
            for match in matches:
                yield match.group(num)

        scode = self.ensure_str(scode)
        assert self._re.match(
            '^@|^\$\d+', args[1]), ValueError('args1 should match ^@|^\$\d+')
        arg1, arg2 = args[1][0], args[1][1:]
        com = self._re.compile(args[0])
        if arg1 == '@':
            result = com.sub(arg2, scode)
            return self.ensure_list(result)
        else:
            result = com.finditer(scode)
            return gen_match(result, int(arg2))