Fix for the Python regexp wizard.

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 06 Jul 2013 16:35:20 +0200
changeset 2772
8e88a2bae65b
parent 2771
281c9b30dd91
child 2774
72fab2c15e28

Fix for the Python regexp wizard.

Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Sat Jul 06 15:48:58 2013 +0200
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Sat Jul 06 16:35:20 2013 +0200
@@ -425,21 +425,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