Small corrections to the regexp wizards.

Sat, 22 Jun 2013 15:36:46 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 22 Jun 2013 15:36:46 +0200
changeset 2733
0c4c648a93b3
parent 2732
c14fe50c113e
child 2734
eddb1a77f771

Small corrections to the regexp wizards.

Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py	Fri Jun 21 19:28:37 2013 +0200
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardCharactersDialog.py	Sat Jun 22 15:36:46 2013 +0200
@@ -299,7 +299,9 @@
                 self.__formatCharacter(index, char2))
         
         if regexp:
-            if len(regexp) == 2 and regexp in self.predefinedClasses:
+            if (len(regexp) == 2 and \
+                (regexp in self.predefinedClasses or regexp in self.specialChars)) or \
+               len(regexp) == 1:
                 return regexp
             else:
                 return "[{0}]".format(regexp)
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py	Fri Jun 21 19:28:37 2013 +0200
+++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardCharactersDialog.py	Sat Jun 22 15:36:46 2013 +0200
@@ -638,7 +638,10 @@
                 self.__formatCharacter(char2, format))
         
         if regexp:
-            if regexp.startswith("\\") and regexp.count("\\") == 1 and "-" not in regexp:
+            if (regexp.startswith("\\") and \
+                regexp.count("\\") == 1 and \
+                "-" not in regexp) or \
+               len(regexp) == 1:
                 return regexp
             else:
                 return "[{0}]".format(regexp)

eric ide

mercurial