def isSummary(self, text): re = QRegExp("(In )?((The|This) )?(%s )?.*(tutorial|example|demo|application)" % self.name, Qt.CaseInsensitive) return ('[' not in text) and (re.indexIn(text) >= 0)