Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py

branch
5_3_x
changeset 2773
a6d129e83b21
parent 2753
997fec8d8000
child 2775
a1a4715a4eb0
equal deleted inserted replaced
2767:4e1314bbe21f 2773:a6d129e83b21
424 """ 424 """
425 regex = self.regexpTextEdit.toPlainText() 425 regex = self.regexpTextEdit.toPlainText()
426 text = self.textTextEdit.toPlainText() 426 text = self.textTextEdit.toPlainText()
427 if regex and text: 427 if regex and text:
428 try: 428 try:
429 flags = 0
430 if not self.caseSensitiveCheckBox.isChecked():
431 flags |= re.IGNORECASE
432 if self.multilineCheckBox.isChecked():
433 flags |= re.MULTILINE
434 if self.dotallCheckBox.isChecked():
435 flags |= re.DOTALL
436 if self.verboseCheckBox.isChecked():
437 flags |= re.VERBOSE
429 if self.py2Button.isChecked(): 438 if self.py2Button.isChecked():
430 regobj = re.compile(regex, 439 if self.localeCheckBox.isChecked():
431 (not self.caseSensitiveCheckBox.isChecked() and re.IGNORECASE or 0) | \ 440 flags |= re.LOCALE
432 self.multilineCheckBox.isChecked() and re.MULTILINE or 0 | \ 441 if self.unicodeCheckBox.isChecked():
433 self.dotallCheckBox.isChecked() and re.DOTALL or 0 | \ 442 flags |= re.UNICODE
434 self.verboseCheckBox.isChecked() and re.VERBOSE or 0 | \
435 self.localeCheckBox.isChecked() and re.LOCALE or 0 | \
436 self.unicodeCheckBox.isChecked() and re.UNICODE or 0)
437 else: 443 else:
438 regobj = re.compile(regex, 444 if not self.unicodeCheckBox.isChecked():
439 (not self.caseSensitiveCheckBox.isChecked() and re.IGNORECASE or 0) | \ 445 flags |= re.UNICODE
440 self.multilineCheckBox.isChecked() and re.MULTILINE or 0 | \ 446 regobj = re.compile(regex, flags)
441 self.dotallCheckBox.isChecked() and re.DOTALL or 0 | \
442 self.verboseCheckBox.isChecked() and re.VERBOSE or 0 | \
443 (not self.unicodeCheckBox.isChecked() and re.UNICODE or 0))
444 matchobj = regobj.search(text, startpos) 447 matchobj = regobj.search(text, startpos)
445 if matchobj is not None: 448 if matchobj is not None:
446 captures = len(matchobj.groups()) 449 captures = len(matchobj.groups())
447 if captures is None: 450 if captures is None:
448 captures = 0 451 captures = 0

eric ide

mercurial