17 from .Ui_QRegularExpressionWizardCharactersDialog import \ |
17 from .Ui_QRegularExpressionWizardCharactersDialog import \ |
18 Ui_QRegularExpressionWizardCharactersDialog |
18 Ui_QRegularExpressionWizardCharactersDialog |
19 |
19 |
20 |
20 |
21 class QRegularExpressionWizardCharactersDialog( |
21 class QRegularExpressionWizardCharactersDialog( |
22 QDialog, Ui_QRegularExpressionWizardCharactersDialog): |
22 QDialog, Ui_QRegularExpressionWizardCharactersDialog): |
23 """ |
23 """ |
24 Class implementing a dialog for entering character classes. |
24 Class implementing a dialog for entering character classes. |
25 """ |
25 """ |
26 def __init__(self, parent=None): |
26 def __init__(self, parent=None): |
27 """ |
27 """ |
590 regexp += "{0}-{1}".format( |
590 regexp += "{0}-{1}".format( |
591 self.__formatCharacter(char1, format), |
591 self.__formatCharacter(char1, format), |
592 self.__formatCharacter(char2, format)) |
592 self.__formatCharacter(char2, format)) |
593 |
593 |
594 if regexp: |
594 if regexp: |
595 if (regexp.startswith("\\") and \ |
595 if (regexp.startswith("\\") and |
596 regexp.count("\\") == 1 and \ |
596 regexp.count("\\") == 1 and |
597 "-" not in regexp) or \ |
597 "-" not in regexp) or \ |
598 len(regexp) == 1: |
598 len(regexp) == 1: |
599 return regexp |
599 return regexp |
600 else: |
600 else: |
601 return "[{0}]".format(regexp) |
601 return "[{0}]".format(regexp) |