]> git.lyx.org Git - lyx.git/commitdiff
Remove use of QRegExp
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 20 Feb 2023 16:38:59 +0000 (17:38 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 3 Mar 2023 09:49:32 +0000 (10:49 +0100)
QRegexp has been replaced with QRegularExpression in Qt5. Now that we
have dropped support for Qt4, there is no need for keeping it around.

14 files changed:
src/frontends/qt/CategorizedCombo.cpp
src/frontends/qt/GuiAbout.cpp
src/frontends/qt/GuiApplication.cpp
src/frontends/qt/GuiDocument.cpp
src/frontends/qt/GuiListings.cpp
src/frontends/qt/GuiLog.cpp
src/frontends/qt/GuiLog.h
src/frontends/qt/GuiPrefs.cpp
src/frontends/qt/GuiTabular.cpp
src/frontends/qt/GuiThesaurus.cpp
src/frontends/qt/LaTeXHighlighter.cpp
src/frontends/qt/LayoutBox.cpp
src/frontends/qt/Validator.cpp
src/support/qstring_helpers.cpp

index 81cf89ab617d98c9bb5839a20a6cc991b3dfc1b2..43ce6cbdf7d0dd5d907682e611a465f8d9b1ae01 100644 (file)
@@ -34,9 +34,6 @@
 #include <QSortFilterProxyModel>
 #include <QStandardItemModel>
 #include <QTextFrame>
-#if QT_VERSION >= 0x060000
-#include <QtCore5Compat/QRegExp>
-#endif
 
 using namespace lyx::support;
 
@@ -273,11 +270,7 @@ QString CCItemDelegate::underlineFilter(QString const & s) const
        if (f.isEmpty())
                return s;
        QString r(s);
-#if QT_VERSION < 0x060000
-       QRegExp pattern(charFilterRegExpC(f));
-#else
        QRegularExpression pattern(charFilterRegExpC(f));
-#endif
        r.replace(pattern, "<u><b>\\1</b></u>");
        return r;
 }
index 35375c969c4819cd39cb0a66eda2faeccd44bc7b..539739bff89cc4be0032d50fe92f4d10d6fae852 100644 (file)
@@ -127,13 +127,8 @@ static QString release_notes()
                                        continue;
 
                                // detect links to the tracker
-#if QT_VERSION < 0x060000
-                               line.replace(QRegExp("(bug )(\\#)(\\d+)*"),
-                                            "<a href=\"http://www.lyx.org/trac/ticket/\\3\">\\1\\3</a>");
-#else
                                line.replace(QRegularExpression("(bug )(\\#)(\\d+)*"),
                                             "<a href=\"http://www.lyx.org/trac/ticket/\\3\">\\1\\3</a>");
-#endif
 
                                // headings
                                if (line.startsWith("!!!")) {
index 25ca4b2eff0c41fe98a764224038d28836cbd149..5750df925056005e5434b4c255d852398b7484f6 100644 (file)
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
 #include <QRandomGenerator>
 #endif
-#include <QRegExp>
 #include <QSessionManager>
 #include <QSettings>
 #include <QSocketNotifier>
@@ -2623,16 +2622,6 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow,
                int x, y;
                int w, h;
                QChar sx, sy;
-#if QT_VERSION < 0x060000
-               QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" );
-               re.indexIn(geometry_arg);
-               w = re.cap(1).toInt();
-               h = re.cap(2).toInt();
-               x = re.cap(3).toInt();
-               y = re.cap(4).toInt();
-               sx = re.cap(3).isEmpty() ? '+' : re.cap(3).at(0);
-               sy = re.cap(4).isEmpty() ? '+' : re.cap(4).at(0);
-#else
                QRegularExpression re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" );
                QRegularExpressionMatch match = re.match(geometry_arg);
                w = match.captured(1).toInt();
@@ -2641,7 +2630,7 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow,
                y = match.captured(4).toInt();
                sx = match.captured(3).isEmpty() ? '+' : match.captured(3).at(0);
                sy = match.captured(4).isEmpty() ? '+' : match.captured(4).at(0);
-#endif
+
                // Set initial geometry such that we can get the frame size.
                view->setGeometry(x, y, w, h);
                int framewidth = view->geometry().x() - view->x();
index a9a9ef495b2cc0679865afcd4da71a73607e20d4..8af560681c36dcae2545b7817491a083cf3e1408 100644 (file)
@@ -4002,13 +4002,8 @@ void GuiDocument::applyView()
                pdf.pagemode.clear();
        pdf.quoted_options = pdf.quoted_options_check(
                                fromqstr(pdfSupportModule->optionsTE->toPlainText()));
-#if QT_VERSION < 0x060000
-       bp_.document_metadata = qstring_to_ucs4(pdfSupportModule->metadataTE->toPlainText()
-                                               .trimmed().replace(QRegExp("\n+"), "\n"));
-#else
        bp_.document_metadata = qstring_to_ucs4(pdfSupportModule->metadataTE->toPlainText()
                                                .trimmed().replace(QRegularExpression("\n+"), "\n"));
-#endif
 
        // change tracking
        bp_.track_changes = changesModule->trackChangesCB->isChecked();
index b1a1e8cac2bdf755e7a53210170038a31162d67e..246cc2f06e0735bf840cfedf2c2892fe348e038c 100644 (file)
 #include <QLineEdit>
 #include <QPushButton>
 #include <QValidator>
-#if QT_VERSION < 0x060000
-#include <QRegExpValidator>
-#else
 #include <QRegularExpressionValidator>
-#endif
 
 using namespace std;
 using namespace lyx::support;
@@ -236,11 +232,7 @@ GuiListings::GuiListings(GuiView & lv)
        numberStepLE->setValidator(new QIntValidator(0, 1000000, this));
        firstlineLE->setValidator(new QIntValidator(0, 1000000, this));
        lastlineLE->setValidator(new QIntValidator(0, 1000000, this));
-#if QT_VERSION < 0x060000
-       placementLE->setValidator(new QRegExpValidator(QRegExp("[\\*tbph]*"), this));
-#else
        placementLE->setValidator(new QRegularExpressionValidator(QRegularExpression("[\\*tbph]*"), this));
-#endif
 
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
        bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
index f908c8fb1872c4ab43594614cc3643b59c794d92..9ad1673de337159f35fef438c1498bf5c636bc4c 100644 (file)
@@ -41,21 +41,12 @@ namespace frontend {
 // Regular expressions needed at several places
 // FIXME: These regexes are incomplete. It would be good if we could collect those used in LaTeX::scanLogFile
 //        and LaTeX::scanBlgFile and re-use them here!(spitz, 2013-05-27)
-#if QT_VERSION < 0x060000
-// Information
-QRegExp exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|.*> INFO - |\\(|\\\\).*$");
-// Warnings
-QRegExp exprWarning("^(## Warning|LaTeX Warning|LaTeX Font Warning|Package [\\w\\.]+ Warning|Class \\w+ Warning|Warning--|Underfull|Overfull|.*> WARN - ).*$");
-// Errors
-QRegExp exprError("^(ERROR: |!|.*---line [0-9]+ of file|.*> FATAL - |.*> ERROR - |Missing character: There is no ).*$");
-#else
 // Information
 QRegularExpression exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|.*> INFO - |\\(|\\\\).*$");
 // Warnings
 QRegularExpression exprWarning("^(## Warning|LaTeX Warning|LaTeX Font Warning|Package [\\w\\-\\.]+ Warning|Class \\w+ Warning|Warning--|Underfull|Overfull|.*> WARN - ).*$");
 // Errors
 QRegularExpression exprError("^(ERROR: |!|.*---line [0-9]+ of file|.*> FATAL - |.*> ERROR - |Missing character: There is no ).*$");
-#endif
 
 
 /////////////////////////////////////////////////////////////////////
@@ -91,29 +82,6 @@ LogHighlighter::LogHighlighter(QTextDocument * parent)
 
 void LogHighlighter::highlightBlock(QString const & text)
 {
-#if QT_VERSION < 0x060000
-       // Info
-       int index = exprInfo.indexIn(text);
-       while (index >= 0) {
-               int length = exprInfo.matchedLength();
-               setFormat(index, length, infoFormat);
-               index = exprInfo.indexIn(text, index + length);
-       }
-       // LaTeX Warning:
-       index = exprWarning.indexIn(text);
-       while (index >= 0) {
-               int length = exprWarning.matchedLength();
-               setFormat(index, length, warningFormat);
-               index = exprWarning.indexIn(text, index + length);
-       }
-       // ! error
-       index = exprError.indexIn(text);
-       while (index >= 0) {
-               int length = exprError.matchedLength();
-               setFormat(index, length, errorFormat);
-               index = exprError.indexIn(text, index + length);
-       }
-#else
        // Info
        QRegularExpressionMatch match = exprInfo.match(text);
        int index = match.capturedStart(1);
@@ -141,7 +109,6 @@ void LogHighlighter::highlightBlock(QString const & text)
                match = exprError.match(text, index + length);
                index = match.capturedStart(1);
        }
-#endif
 }
 
 
@@ -234,11 +201,7 @@ void GuiLog::on_openDirPB_clicked()
 }
 
 
-#if QT_VERSION < 0x060000
-void GuiLog::goTo(QRegExp const & exp) const
-#else
 void GuiLog::goTo(QRegularExpression const & exp) const
-#endif
 {
        QTextCursor const newc =
                logTB->document()->find(exp, logTB->textCursor());
@@ -246,11 +209,7 @@ void GuiLog::goTo(QRegularExpression const & exp) const
 }
 
 
-#if QT_VERSION < 0x060000
-bool GuiLog::contains(QRegExp const & exp) const
-#else
 bool GuiLog::contains(QRegularExpression const & exp) const
-#endif
 {
        return !logTB->document()->find(exp, logTB->textCursor()).isNull();
 }
index cd62390fc24514f721448e3805b718b271f67246..0ceb8d5d2c6a5bbb7dc463620482084f6015ce85 100644 (file)
@@ -66,17 +66,10 @@ private:
        docstring title() const;
        /// put the log file into the ostream
        void getContents(std::ostream & ss) const;
-#if QT_VERSION < 0x060000
-       /// go to the next occurrence of the RegExp
-       void goTo(QRegExp const & exp) const;
-       /// does the document after cursor position contain the RegExp?
-       bool contains(QRegExp const & exp) const;
-#else
        /// go to the next occurrence of the RegExp
        void goTo(QRegularExpression const & exp) const;
        /// does the document after cursor position contain the RegExp?
        bool contains(QRegularExpression const & exp) const;
-#endif
 
 private:
        /// Recognized log file-types
index 9480dc2c6f8387b9d1bf696204beda70ccf581cb..4368b683e299fcff55c4486a9e0cc8974ba6d2f3 100644 (file)
@@ -189,11 +189,7 @@ QString browseRelToSub(QString const & filename, QString const & relpath,
                toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
 
        QString testname = reloutname;
-#if QT_VERSION < 0x060000
-       testname.remove(QRegExp("^(\\.\\./)+"));
-#else
        testname.remove(QRegularExpression("^(\\.\\./)+"));
-#endif
 
        if (testname.contains("/"))
                return outname;
@@ -2469,11 +2465,7 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
        startCommandED->setValidator(new NoNewLineValidator(startCommandED));
        endCommandED->setValidator(new NoNewLineValidator(endCommandED));
 
-#if QT_VERSION < 0x060000
-       defaultDecimalSepED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
-#else
        defaultDecimalSepED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this));
-#endif
        defaultDecimalSepED->setMaxLength(1);
 
        defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
index ddb6942688e1eee5fbfe7dc917bc80f7c04512db..84012beb8ebb5b8b7eccacb3bc8cce824a0487da 100644 (file)
@@ -178,11 +178,7 @@ GuiTabular::GuiTabular(QWidget * parent)
        connect(tabularWidthED, SIGNAL(textEdited(const QString &)),
                this, SLOT(checkEnabled()));
 
-#if QT_VERSION < 0x060000
-       decimalPointED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
-#else
        decimalPointED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this));
-#endif
        decimalPointED->setMaxLength(1);
 
        // initialize the length validator
index f3219563b754e4753dca638a5b5448ebc8ad8f42..e888cbf0ed2139337317e08eadeeb2dde6683ccd 100644 (file)
@@ -124,22 +124,9 @@ void GuiThesaurus::selectionChanged()
        QString item = meaningsTV->currentItem()->text(col);
        // cut out the classification in brackets:
        // "hominid (generic term)" -> "hominid"
-#if QT_VERSION < 0x060000
-       QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
-#else
        QRegularExpression re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
-#endif
        // This is for items with classifications at the beginning:
        // "(noun) man" -> "man"; "(noun) male (generic term)" -> "male"
-#if QT_VERSION < 0x060000
-       QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
-       int pos = re.indexIn(item);
-       if (pos > -1)
-               item = re.cap(1).trimmed();
-       pos = rex.indexIn(item);
-       if (pos > -1)
-               item = rex.cap(2).trimmed();
-#else
        QRegularExpression rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
        QRegularExpressionMatch match = re.match(item);
        if (match.hasMatch())
@@ -147,7 +134,6 @@ void GuiThesaurus::selectionChanged()
        match = rex.match(item);
        if (match.hasMatch())
                item = match.captured(2).trimmed();
-#endif
        replaceED->setText(item);
        replacePB->setEnabled(!isBufferReadonly());
        changed();
@@ -165,22 +151,9 @@ void GuiThesaurus::selectionClicked(QTreeWidgetItem * item, int col)
        QString str = item->text(col);
        // cut out the classification in brackets:
        // "hominid (generic term)" -> "hominid"
-#if QT_VERSION < 0x060000
-       QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
-#else
        QRegularExpression re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
-#endif
        // This is for items with classifications at the beginning:
        // "(noun) man" -> "man"; "(noun) male (generic term)" -> "male"
-#if QT_VERSION < 0x060000
-       QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
-       int pos = re.indexIn(str);
-       if (pos > -1)
-               str = re.cap(1).trimmed();
-       pos = rex.indexIn(str);
-       if (pos > -1)
-               str = rex.cap(2).trimmed();
-#else
        QRegularExpression rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
        QRegularExpressionMatch match = re.match(str);
        if (match.hasMatch())
@@ -188,7 +161,6 @@ void GuiThesaurus::selectionClicked(QTreeWidgetItem * item, int col)
        match = rex.match(str);
        if (match.hasMatch())
                str = match.captured(2).trimmed();
-#endif
        entryCO->insertItem(0, str);
        entryCO->setCurrentIndex(0);
 
index 80e7a09cbd8bb66060f7fb850c8a680ce8506f7e..8336f7aa56cf1b4c4ed9366c5864f9d79ef2f3cd 100644 (file)
@@ -46,109 +46,6 @@ LaTeXHighlighter::LaTeXHighlighter(QTextDocument * parent, bool at_letter, bool
 
 void LaTeXHighlighter::highlightBlock(QString const & text)
 {
-#if QT_VERSION < 0x060000
-       // keyval
-       if (keyval_) {
-               // Highlight key-val options. Used in some option widgets.
-               static const QRegExp exprKeyvalkey("[^=,]+");
-               static const QRegExp exprKeyvalval("[^,]+");
-               int kvindex = exprKeyvalkey.indexIn(text);
-               while (kvindex >= 0) {
-                       int length = exprKeyvalkey.matchedLength();
-                       setFormat(kvindex, length, keyFormat);
-                       int kvvindex = exprKeyvalval.indexIn(text, kvindex + length);
-                       if (kvvindex > 0) {
-                               length += exprKeyvalval.matchedLength();
-                               setFormat(kvvindex, length, valFormat);
-                       }
-                       kvindex = exprKeyvalkey.indexIn(text, kvindex + length);
-               }
-       }
-       // $ $
-       static const QRegExp exprMath("\\$[^\\$]*\\$");
-       int index = exprMath.indexIn(text);
-       while (index >= 0) {
-               int length = exprMath.matchedLength();
-               setFormat(index, length, mathFormat);
-               index = exprMath.indexIn(text, index + length);
-       }
-       // [ ]
-       static const QRegExp exprStartDispMath("(\\\\\\[|"
-               "\\\\begin\\{equation\\**\\}|"
-               "\\\\begin\\{eqnarray\\**\\}|"
-               "\\\\begin\\{align(ed|at)*\\**\\}|"
-               "\\\\begin\\{flalign\\**\\}|"
-               "\\\\begin\\{gather\\**\\}|"
-               "\\\\begin\\{multline\\**\\}|"
-               "\\\\begin\\{array\\**\\}|"
-               "\\\\begin\\{cases\\**\\}"
-               ")");
-       static const QRegExp exprEndDispMath("(\\\\\\]|"
-               "\\\\end\\{equation\\**\\}|"
-               "\\\\end\\{eqnarray\\**\\}|"
-               "\\\\end\\{align(ed|at)*\\**\\}|"
-               "\\\\end\\{flalign\\**\\}|"
-               "\\\\end\\{gather\\**\\}|"
-               "\\\\end\\{multline\\**\\}|"
-               "\\\\end\\{array\\**\\}|"
-               "\\\\end\\{cases\\**\\}"
-               ")");
-       int startIndex = 0;
-       // if previous block was in 'disp math'
-       // start search from 0 (for end disp math)
-       // otherwise, start search from 'begin disp math'
-       if (previousBlockState() != 1)
-               startIndex = exprStartDispMath.indexIn(text);
-       while (startIndex >= 0) {
-               int endIndex = exprEndDispMath.indexIn(text, startIndex);
-               int length;
-               if (endIndex == -1) {
-                       setCurrentBlockState(1);
-                       length = text.length() - startIndex;
-               } else {
-                       length = endIndex - startIndex + exprEndDispMath.matchedLength();
-               }
-               setFormat(startIndex, length, mathFormat);
-               startIndex = exprStartDispMath.indexIn(text, startIndex + length);
-       }
-       // \whatever
-       static const QRegExp exprKeywordAtOther("\\\\[A-Za-z]+");
-       // \wh@tever
-       static const QRegExp exprKeywordAtLetter("\\\\[A-Za-z@]+");
-       QRegExp const & exprKeyword = at_letter_ ? exprKeywordAtLetter
-                                                : exprKeywordAtOther;
-       index = exprKeyword.indexIn(text);
-       while (index >= 0) {
-               int length = exprKeyword.matchedLength();
-               setFormat(index, length, keywordFormat);
-               index = exprKeyword.indexIn(text, index + length);
-       }
-       // %comment
-       // Treat a line as a comment starting at a percent sign
-       // * that is the first character in a line
-       // * that is preceded by
-       // ** an even number of backslashes
-       // ** any character other than a backslash
-       QRegExp exprComment("(?:^|[^\\\\])(?:\\\\\\\\)*(%).*$");
-       exprComment.indexIn(text);
-       index = exprComment.pos(1);
-       while (index >= 0) {
-               int const length = exprComment.matchedLength()
-                                - (index - exprComment.pos(0));
-               setFormat(index, length, commentFormat);
-               exprComment.indexIn(text, index + length);
-               index = exprComment.pos(1);
-       }
-       // <LyX Warning: ...>
-       QString lyxwarn = qt_("LyX Warning: ");
-       QRegExp exprWarning("<" + lyxwarn + "[^<]*>");
-       index = exprWarning.indexIn(text);
-       while (index >= 0) {
-               int length = exprWarning.matchedLength();
-               setFormat(index, length, warningFormat);
-               index = exprWarning.indexIn(text, index + length);
-       }
-#else
        // keyval
        if (keyval_) {
                // Highlight key-val options. Used in some option widgets.
@@ -264,7 +161,6 @@ void LaTeXHighlighter::highlightBlock(QString const & text)
                match = exprWarning.match(text, index + length);
                index = match.capturedStart(0);
        }
-#endif
 }
 
 } // namespace frontend
index 5b15e98741e8d4cc301714ae08f9aebfd63d06b4..573ec2784c4bdc6fe809976652ff6fb51c81cbe1 100644 (file)
@@ -43,7 +43,6 @@
 #include <QHeaderView>
 #include <QItemDelegate>
 #include <QPainter>
-#include <QRegExp>
 #include <QSortFilterProxyModel>
 #include <QStandardItemModel>
 #include <QTextFrame>
@@ -300,11 +299,7 @@ QString LayoutItemDelegate::underlineFilter(QString const & s) const
        if (f.isEmpty())
                return s;
        QString r(s);
-#if QT_VERSION < 0x060000
-       QRegExp pattern(charFilterRegExpC(f));
-#else
        QRegularExpression pattern(charFilterRegExpC(f));
-#endif
        r.replace(pattern, "<u><b>\\1</b></u>");
        return r;
 }
index 8ad18310525c7fd4a2af0c575de36dcc2f6a00f2..9e8d8d07b9a5a3631b4c56d3eb23ed0cd2ded8d2 100644 (file)
@@ -192,11 +192,7 @@ NoNewLineValidator::NoNewLineValidator(QWidget * parent)
 
 QValidator::State NoNewLineValidator::validate(QString & qtext, int &) const
 {
-#if QT_VERSION < 0x060000
-       qtext.remove(QRegExp("[\\n\\r]"));
-#else
        qtext.remove(QRegularExpression("[\\n\\r]"));
-#endif
        return QValidator::Acceptable;
 }
 
index fadca76a657eb5cdfa13b3738dd59269d4911e8d..e39dc7fb3359b90a51d32e19c8be678006820214 100644 (file)
@@ -18,7 +18,7 @@
 #include "support/docstring.h"
 #include "support/qstring_helpers.h"
 
-#include <QRegExp>
+#include <QRegularExpression>
 #include <QLocale>
 #include <QString>
 #include <QVector>
@@ -83,9 +83,10 @@ QString charFilterRegExp(QString const & filter)
        QString re = ".*";
        for (QChar const & c : filter) {
                if (c.isLower())
-                       re +=  "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
+                       re +=  "[" + QRegularExpression::escape(c)
+                                  + QRegularExpression::escape(c.toUpper()) + "]";
                else
-                       re +=  QRegExp::escape(c);
+                       re +=  QRegularExpression::escape(c);
        }
        return re;
 }
@@ -95,9 +96,10 @@ QString charFilterRegExpC(QString const & filter)
        QString re = "(";
        for (QChar const & c : filter) {
                if (c.isLower())
-                       re +=  "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
+                       re +=  "[" + QRegularExpression::escape(c)
+                              + QRegularExpression::escape(c.toUpper()) + "]";
                else
-                       re +=  QRegExp::escape(c);
+                       re +=  QRegularExpression::escape(c);
        }
        return re + ")";
 }