Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py

branch
5_3_x
changeset 2773
a6d129e83b21
parent 2753
997fec8d8000
child 2775
a1a4715a4eb0
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Wed Jul 03 19:23:52 2013 +0200
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Sat Jul 06 16:35:20 2013 +0200
@@ -426,21 +426,24 @@
         text = self.textTextEdit.toPlainText()
         if regex and text:
             try:
+                flags = 0
+                if not self.caseSensitiveCheckBox.isChecked():
+                    flags |= re.IGNORECASE
+                if self.multilineCheckBox.isChecked():
+                    flags |= re.MULTILINE
+                if self.dotallCheckBox.isChecked():
+                    flags |= re.DOTALL
+                if self.verboseCheckBox.isChecked():
+                    flags |= re.VERBOSE
                 if self.py2Button.isChecked():
-                    regobj = re.compile(regex,
-                        (not self.caseSensitiveCheckBox.isChecked() and re.IGNORECASE or 0) | \
-                        self.multilineCheckBox.isChecked() and re.MULTILINE or 0 | \
-                        self.dotallCheckBox.isChecked() and re.DOTALL or 0 | \
-                        self.verboseCheckBox.isChecked() and re.VERBOSE or 0 | \
-                        self.localeCheckBox.isChecked() and re.LOCALE or 0 | \
-                        self.unicodeCheckBox.isChecked() and re.UNICODE or 0)
+                    if self.localeCheckBox.isChecked():
+                        flags |= re.LOCALE
+                    if self.unicodeCheckBox.isChecked():
+                        flags |= re.UNICODE
                 else:
-                    regobj = re.compile(regex,
-                        (not self.caseSensitiveCheckBox.isChecked() and re.IGNORECASE or 0) | \
-                        self.multilineCheckBox.isChecked() and re.MULTILINE or 0 | \
-                        self.dotallCheckBox.isChecked() and re.DOTALL or 0 | \
-                        self.verboseCheckBox.isChecked() and re.VERBOSE or 0 | \
-                        (not self.unicodeCheckBox.isChecked() and re.UNICODE or 0))
+                    if not self.unicodeCheckBox.isChecked():
+                        flags |= re.UNICODE
+                regobj = re.compile(regex, flags)
                 matchobj = regobj.search(text, startpos)
                 if matchobj is not None:
                     captures = len(matchobj.groups())

eric ide

mercurial