'Highlight all found patterns'

def highlight_found_results(self, pattern, words=False, regexp=False):

    pattern = to_text_string(pattern)
    if (not pattern):
        return
    if (not regexp):
        pattern = re.escape(to_text_string(pattern))
    pattern = (('\\b%s\\b' % pattern) if words else pattern)
    text = to_text_string(self.toPlainText())
    try:
        regobj = re.compile(pattern)
    except sre_constants.error:
        return
    extra_selections = []
    self.found_results = []
    for match in regobj.finditer(text):
        (pos1, pos2) = match.span()
        selection = QTextEdit.ExtraSelection()
        selection.format.setBackground(self.found_results_color)
        selection.cursor = self.textCursor()
        selection.cursor.setPosition(pos1)
        self.found_results.append(selection.cursor.blockNumber())
        selection.cursor.setPosition(pos2, QTextCursor.KeepAnchor)
        extra_selections.append(selection)
    self.set_extra_selections('find', extra_selections)
    self.update_extra_selections()
