423 """ |
423 """ |
424 regex = self.regexpTextEdit.toPlainText() |
424 regex = self.regexpTextEdit.toPlainText() |
425 text = self.textTextEdit.toPlainText() |
425 text = self.textTextEdit.toPlainText() |
426 if regex and text: |
426 if regex and text: |
427 try: |
427 try: |
|
428 flags = 0 |
|
429 if not self.caseSensitiveCheckBox.isChecked(): |
|
430 flags |= re.IGNORECASE |
|
431 if self.multilineCheckBox.isChecked(): |
|
432 flags |= re.MULTILINE |
|
433 if self.dotallCheckBox.isChecked(): |
|
434 flags |= re.DOTALL |
|
435 if self.verboseCheckBox.isChecked(): |
|
436 flags |= re.VERBOSE |
428 if self.py2Button.isChecked(): |
437 if self.py2Button.isChecked(): |
429 regobj = re.compile(regex, |
438 if self.localeCheckBox.isChecked(): |
430 (not self.caseSensitiveCheckBox.isChecked() and re.IGNORECASE or 0) | \ |
439 flags |= re.LOCALE |
431 self.multilineCheckBox.isChecked() and re.MULTILINE or 0 | \ |
440 if self.unicodeCheckBox.isChecked(): |
432 self.dotallCheckBox.isChecked() and re.DOTALL or 0 | \ |
441 flags |= re.UNICODE |
433 self.verboseCheckBox.isChecked() and re.VERBOSE or 0 | \ |
|
434 self.localeCheckBox.isChecked() and re.LOCALE or 0 | \ |
|
435 self.unicodeCheckBox.isChecked() and re.UNICODE or 0) |
|
436 else: |
442 else: |
437 regobj = re.compile(regex, |
443 if not self.unicodeCheckBox.isChecked(): |
438 (not self.caseSensitiveCheckBox.isChecked() and re.IGNORECASE or 0) | \ |
444 flags |= re.UNICODE |
439 self.multilineCheckBox.isChecked() and re.MULTILINE or 0 | \ |
445 regobj = re.compile(regex, flags) |
440 self.dotallCheckBox.isChecked() and re.DOTALL or 0 | \ |
|
441 self.verboseCheckBox.isChecked() and re.VERBOSE or 0 | \ |
|
442 (not self.unicodeCheckBox.isChecked() and re.UNICODE or 0)) |
|
443 matchobj = regobj.search(text, startpos) |
446 matchobj = regobj.search(text, startpos) |
444 if matchobj is not None: |
447 if matchobj is not None: |
445 captures = len(matchobj.groups()) |
448 captures = len(matchobj.groups()) |
446 if captures is None: |
449 if captures is None: |
447 captures = 0 |
450 captures = 0 |