def METHOD_NAME(vd, sheet, moveCursor=False, reverse=False, regex_flags=None, **kwargs):
        'Set row index if moveCursor, otherwise return list of row indexes.'
        def findMatchingColumn(sheet, row, columns, func):
            'Find column for which func matches the displayed value in this row'
            for c in columns:
                if func(c.getDisplayValue(row)):
                    return c
        vd.searchContext.update(kwargs)
        regex = kwargs.get("regex")
        if regex:
            if regex_flags is None:
                regex_flags = sheet.options.regex_flags  # regex_flags defined in features.regex
            flagbits = sum(getattr(re, f.upper()) for f in regex_flags)
            vd.searchContext["regex"] = re.compile(regex, flagbits) or vd.error('invalid regex: %s' % regex)
        regex = vd.searchContext.get("regex") or vd.fail("no regex")
        columns = vd.searchContext.get("columns")
        if columns == "cursorCol":
            columns = [sheet.cursorCol]
        elif columns == "visibleCols":
            columns = tuple(sheet.visibleCols)
        elif isinstance(columns, Column):
            columns = [columns]
        if not columns:
            vd.error('bad columns')
        searchBackward = vd.searchContext.get("backward")
        if reverse:
            searchBackward = not searchBackward
        matchingRowIndexes = 0
        for rowidx in rotateRange(len(sheet.rows), sheet.cursorRowIndex, reverse=searchBackward):
            c = findMatchingColumn(sheet, sheet.rows[rowidx], columns, regex.search)
            if c:
                if moveCursor:
                    sheet.cursorRowIndex = rowidx
                    sheet.cursorVisibleColIndex = sheet.visibleCols.index(c)
                    return
                else:
                    matchingRowIndexes += 1
                    yield rowidx
        if kwargs.get('printStatus', True):
            vd.status('%s matches for /%s/' % (matchingRowIndexes, regex.pattern))