Fix for the Python regexp wizard. 5_3_x

Sat, 06 Jul 2013 16:35:20 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 06 Jul 2013 16:35:20 +0200
branch
5_3_x
changeset 2773
a6d129e83b21
parent 2767
4e1314bbe21f
child 2775
a1a4715a4eb0

Fix for the Python regexp wizard.
(grafted from 8e88a2bae65b79e9dfb28be61d84115ad1fc2168)

Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py file | annotate | diff | comparison | revisions
--- 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